Environments Required
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.
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.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers infrastructure playbook: https://agentwranglers.se/playbook/infrastructure/environments/promote-infrastructure-changes.