terraformintermediateconfigurationVerified
Terraform State Lock Error: Causes and Fixes
Last reviewed: 9/14/2026
3 solutions
Exact Error Message
Error: Error acquiring the state lockQuick Fix
Check if another Terraform operation is running, or force unlock if safe: terraform force-unlock LOCK_ID
What This Error Means
Terraform uses state locking to prevent concurrent modifications that could corrupt state. This error occurs when another Terraform operation is currently running or when a lock wasn't properly released after a crash.
Common Symptoms
- •Terraform apply/plan fails with lock error
- •Cannot run concurrent Terraform operations
- •State appears stuck after crash
Common Causes
- •Another Terraform operation is still running
- •Previous operation crashed without releasing lock
- •Network issues preventing lock release
- •Manual lock held by another team member
- •Backend connectivity issues
Diagnostic Steps
- 1Check if anyone else is running Terraform
- 2Review Terraform Cloud/Enterprise for active runs
- 3Check backend connectivity
- 4Review crash logs from failed operation
- 5Verify lock information in backend
Solutions
Solution 1: Wait for existing operation to complete
- 1Check with team if anyone is running Terraform
- 2Wait for the existing operation to finish
- 3Retry your operation after lock is released
Solution 2: Force unlock state lock (use with caution)
- 1Confirm no other operations are actively running
- 2Get the lock ID from error message
- 3Run force unlock command
- 4Immediately retry your operation
Commands to Run
Force unlock can cause state corruption if another operation is actively writing
terraform force-unlock LOCK_IDSolution 3: Fix backend connectivity
- 1Verify backend configuration
- 2Test backend connectivity
- 3Check authentication credentials
- 4Review backend service status
Commands to Run
Reconfiguring backend may require re-authentication
terraform init -reconfigurePrevention Tips
- ✓Use Terraform Cloud/Enterprise for team collaboration
- ✓Implement proper communication for state changes
- ✓Use workspaces for environment isolation
- ✓Monitor Terraform operations
- ✓Set appropriate lock timeouts
Version Notes: Applies to Terraform 1.0+
Official Documentation
Was this helpful?