How do you promote the same Terraform code from dev to stage to prod?
AdvancedScenarioPipelines Terraform Cloud and OpenTofu
Answer
Situation read → Promotion needs to move through environments with the same module versions.
What I'd do →
- Tag module releases; environments pin versions in their own directory.
- Pipeline: merge → apply dev → automated checks → apply stage → manual approval → apply prod, each with its own plan.
- Keep environment differences in tfvars only.
Why → What was proven in dev is the same code in prod; only inputs differ.
Interview tip → Plans are per-environment; never promote a plan file.
More on Pipelines Terraform Cloud and OpenTofu
Build a basic GitHub Actions pipeline: plan on pull request, apply on merge to main.BeginnerReviewers can't read raw plan logs. How do you present the plan in the PR?IntermediateTwo PRs merge close together and both apply to the same stack. What prevents trouble?IntermediateHow do you add a manual approval before prod applies?IntermediateCompare Atlantis, HCP Terraform and a hand-built GitHub Actions pipeline.IntermediateA saved plan was approved yesterday and apply fails because main changed. How do you avoid dead approvals?Intermediate