Interview Prep/Terraform/Partial Applies, Version Mismatches and CI Failures

`Error: Saved plan is stale` — `The given plan file can no longer be applied because the state was changed by another operation after the plan was created.`

IntermediateTroubleshootingPartial Applies, Version Mismatches and CI Failures
Answer

Likely causes → Another apply (or a state command) ran on the same state between your plan -out and apply. Common when two PRs plan in parallel and one merges first.

Diagnose → Check state history / pipeline runs between the plan and apply timestamps.

Fix → Re-run terraform plan -out=tfplan, review, then apply the new plan.

Prevent → Plan → apply in one pipeline with concurrency control per stack; require branches to be up to date before merge.

All Terraform questions

More on Partial Applies, Version Mismatches and CI Failures