Interview Prep/Terraform/Workflow and Providers

The pipeline fails with "Saved plan is stale" after approval. Why did it happen and is it a bug?

AdvancedScenarioWorkflow and Providers
Answer

Situation read → Not a bug; it's the protection working.

What I'd do →

  1. Check what changed state between plan and apply: another run, a manual state edit, or a refresh by a second pipeline.
  2. Re-run the plan job on the current commit and get a new approval.
  3. Prevent recurrence with a CI concurrency group so only one run per stack executes.
concurrency:
  group: tf-prod-network
  cancel-in-progress: false

Why → A plan records the state serial and lineage it was built from. If state moved, applying it could undo someone else's change.

Interview tip → Short gaps between plan and apply reduce this; long-lived approvals make it worse.

All Terraform questions Roadmap: Terraform

More on Workflow and Providers