Two PRs merge close together and both apply to the same stack. What prevents trouble?
IntermediateScenarioPipelines Terraform Cloud and OpenTofu
Answer
Situation read → Concurrent applies to one state.
What I'd do →
- Backend locking guarantees only one writer at a time.
- A CI concurrency group per stack serialises runs without cancelling an in-flight apply.
- Plans are re-created on the merged commit, so a stale PR plan is never applied.
Why → Locking prevents corruption; serialisation prevents confusing failures.
Interview tip → cancel-in-progress: false for applies. Cancelling an apply can leave partial state.
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?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?IntermediateExplain HCP Terraform workflows: VCS-driven, CLI-driven and API-driven.Beginner