State Locking
Cheat sheet · https://pcornel.dk/topic.php?topic=5436
Answer
State locking serializes supported state-writing operations so multiple IaC writers do not concurrently mutate the same state snapshot.
Remember
- State lock ≠ infrastructure-wide lock; it does not stop console/API changes or another state file from managing the same object.
- State or engine metadata ≠ authoritative live-service health; always confirm with provider read-back and target acceptance checks.
- A green execution step ≠ complete convergence when later state persistence, external dependencies or workload readiness remain unverified.
- Provider/API success ≠ business outcome; keep engine evidence and target-domain evidence separate.
First checks
- Backend with locking (S3+DynamoDB/S3 lockfile, azurerm blob lease, consul) — locking
terraform force-unlock <lock-id>— only after confirming no run- CI concurrency limit per state — serialisation
Verify in this order
run → acquire lock → modify state → release
Where it usually breaks
State lock ≠ infrastructure-wide lock; it does not stop console/API changes or another state file from managing the same object. The proof boundary ends where provider/state evidence stops and target-domain acceptance begins.
Configuration/input → graph/state refresh → plan → provider API request → provider terminal result → resource read-back → effective service state → workload.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5436