Applies keep failing with `Error acquiring the state lock` in CI. What do you do?
AdvancedProductionState and Backends in Production
Answer
First read the lock info (who, operation, created time). If a live run holds it, serialize runs: use a CI concurrency group per stack and -lock-timeout=10m so queued runs wait. If it is stale (cancelled job, runner died) confirm no process runs, then terraform force-unlock <ID>. Fix the cause: avoid cancelling apply jobs mid-run, and make pipeline cancellation graceful.
More on State and Backends in Production
Why should Terraform state never be committed to Git?BeginnerHow do you bootstrap the remote backend, given the bucket must exist before Terraform can use it?IntermediateWhat does a hardened S3 state bucket look like?IntermediateWhat is the minimum IAM permission set for the S3 backend?IntermediateHow do you move from DynamoDB locking to S3 native locking in a live fleet?IntermediateState was deleted or corrupted. How do you recover?Advanced