Agent Wranglers

INF-12Recommended

Change staging before production

Apply every infrastructure change to staging first. Apply the same commit to production only after the staging apply and its smoke tests pass.

How to do it

Run the pipeline in order for each commit. Staging applies, the smoke tests run, then production waits for approval. Never edit production values to fix something that staging did not show. Change staging the same way first. The app's own release steps live in staged rollouts.

Examples

YAML example

jobs:
  staging:
    environment: staging
    steps:
      - run: tofu apply -auto-approve -var-file=staging.tfvars && ./smoke-test.sh https://staging.example.com
  production:
    needs: staging
    environment: production   # waits for approval. Apply a reviewed saved plan as in plan-in-review.
    steps:
      - run: tofu plan -var-file=production.tfvars -out=release.tfplan && tofu apply release.tfplan

How to check

For every production apply in the last 90 days, the CI history shows a successful staging apply of the same commit before it.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/environments/promote-infrastructure-changes">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.