Twenty teams run Terraform from CI. Applies collide, plans go stale, and reviews are rubber stamps. How do you fix it?

AdvancedScenarioPipelines at scale
Answer

Situation read → Plans are only valid against the state they were made from. Without locking, ordering and a clear plan in the PR, applies become risky.

What I'd do →

  1. Split state into small stacks per team and component, so teams rarely share a lock.
  2. Use state locking (S3 use_lockfile or a TACOS tool) and queue applies per stack.
  3. Plan on PR, post the plan as a comment, and apply the saved plan after merge; if the state moved since, re-plan and require re-approval.
terraform plan -out=tfplan -input=false
terraform apply -input=false tfplan
  1. Make reviews meaningful: policy checks (OPA/Conftest, Checkov) flag destroys, public resources and IAM wildcards, so humans focus on what matters.
  2. Consider Atlantis, Spacelift, env0 or HCP Terraform; they handle locking, plan-per-PR and policy for you.

Why → A saved plan applied as reviewed is the only way to guarantee "what was approved is what changed".

Interview tip → Say "apply the saved plan file"; applying a fresh plan after approval defeats the review.

All Real-World Interview questions Roadmap: Interview readiness

More on Pipelines at scale