terraform
state_error
ai_generated
partial
Error acquiring the state lock: ConditionalCheckFailedException
ID: terraform/state-lock-dynamodb
85%Fix Rate
88%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1 | active | — | — | — |
Root Cause
Another Terraform process holds the state lock (DynamoDB). Wait or force-unlock.
genericWorkarounds
-
90% success Wait for the other process to finish — check the Lock Info in the error for who holds it
# The error shows Lock Info with: # ID, Who, Operation, Created # Check if that user/CI job is still running # Wait for it to complete, or contact the person # If the process crashed, use force-unlock: terraform force-unlock <LOCK_ID>
Sources: https://developer.hashicorp.com/terraform/language/state/locking
-
88% success If the lock is stale (crashed process), force-unlock: terraform force-unlock <LOCK_ID>
terraform force-unlock
Sources: https://developer.hashicorp.com/terraform/cli/commands/force-unlock
-
82% success Check CI/CD for parallel Terraform runs that need serialization
Check CI/CD for parallel Terraform runs that need serialization
Sources: https://developer.hashicorp.com/terraform/language/state/locking
Dead Ends
Common approaches that don't work:
-
Delete the DynamoDB lock item directly
80% fail
May cause state corruption if another process is running
-
Disable state locking with -lock=false
85% fail
Risks concurrent state modifications — data corruption
Error Chain
Frequently confused with: