Interview Prep/Real-World Interview/Infrastructure as Code & Terraform state

Did you ever have a state lock or corrupted state? What did you do?

AdvancedBehavioralInfrastructure as Code & Terraform state
Answer

Good answer looks like → "A CI job was cancelled mid-apply and left a lock: Error acquiring the state lock. I confirmed no apply was running (checked the CI run and the DynamoDB lock item's Info field for who held it), then ran terraform force-unlock <LOCK_ID>. I ran plan to check the state matched reality. Since S3 versioning was on, we could have restored a previous state version if needed."

Follow-ups to expect → When is force-unlock dangerous? How would you recover a resource missing from state?

Red flags → Deleting the lock or state file without checking.

All Real-World Interview questions Roadmap: Interview readiness

More on Infrastructure as Code & Terraform state