---
title: "Change staging before production · Agent Wranglers"
url: https://agentwranglers.se/playbook/infrastructure/environments/promote-infrastructure-changes
updated: 2026-10-20
licence: "All rights reserved"
---

# Change staging before production

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Environments](https://agentwranglers.se/playbook/infrastructure/environments)
- Rule: Apply every infrastructure change to staging first. Apply the same commit to production only after the staging apply and its smoke tests pass.
- How: 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](https://agentwranglers.se/playbook/engineering/build-test-and-deploy/staged-rollouts).
- Check: For every production apply in the last 90 days, the CI history shows a successful staging apply of the same commit before it.

Example:

```yaml
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
```

**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`.

- Previous: [Build every environment from the same code](https://agentwranglers.se/playbook/infrastructure/environments/same-code-every-environment)
- Next: [Delete preview environments on time](https://agentwranglers.se/playbook/infrastructure/environments/preview-environments)
- [Environments](https://agentwranglers.se/playbook/infrastructure/environments)
