Migrate a GitHub Actions pipeline

Translate an existing plan/apply pipeline while preserving state.

GitHub Actions YAML is not imported directly. Preserve infrastructure, modules, state and reusable scripts; adapt orchestration and identity.

Before and after

# Existing GitHub Actions plan job fragment
jobs:
  plan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: hashicorp/setup-terraform@v3
      - run: terraform init -input=false
      - run: terraform validate
      - run: terraform plan -input=false -out=change.plan
Existing mechanismArgo equivalent
checkout/refValidated intent and immutable revision
setup-terraformPinned runner or own image with CLI
jobs/needsSteps or DAG
upload-artifactPVC or artifact repository
environment approvalArgo suspend/policy and separate controller grant
OIDC roleCluster workload identity
job exitArgo status plus functional result

Put the plan script in the runner

In this fragment, command: [bash] selects the interpreter. source is the Bash code Argo passes to that interpreter: it calls the plan.sh you already use in your pipeline.

script:
  image: ghcr.io/iacstack/iacstack-runner-terraform:v0.1.0-alpha.2
  command: [bash]
  env:
    - {name: INTENT, value: "{{workflow.parameters.intent}}"}
    - {name: WORKFLOW, value: "{{workflow.name}}"}
  volumeMounts:
    - {name: automation, mountPath: /opt/automation, readOnly: true}
  source: |
    set -euo pipefail
    exec bash /opt/automation/plan.sh

The image supplies the tools, such as Terraform and the iacstack CLI. The fragment assumes an automation volume in the WorkflowTemplate, for example a ConfigMap with the key plan.sh. The mount exposes that file at /opt/automation/plan.sh. If your image already ships the script at that path, use that image and remove the mount.

The IaCStack’s spec.sourceRef points to a different location: the repository, path, and version of the Terraform code. plan.sh reads that intent with the iacstack CLI, prepares the code, and runs the plan. Changing sourceRef does not change where the pod loads plan.sh.

These snippets are fragments, not complete runnable workflows. For a concrete complete pipeline, use Build a pipeline from scratch and its downloadable manifest. Adapt source, backend, input mapping and identity. Preserve the saved plan through workspace and artifacts; integrate the CLI using custom runners. A plan-only review must not claim Verified for unapplied changes.

Cutover

Test on isolated state. Record resource IDs, back up state, verify exact backend key, identity and engine/provider versions. Stop previous writers, review first real plan with mutation disabled, investigate unexpected differences. Only then enable governed apply. Rollback requires draining attempts and stopping the new writer before restoring the old one.

Full adoption checklist · CLI reference