When to use
Use when Terraform reports the state is locked and operations cannot proceed.
Preconditions
- You have access to the workspace and can identify the last run/operator.
- You understand the blast radius of forcing an unlock.
Procedure
- Determine whether a Terraform operation is currently running (CI runner, TFC/TFE run, local terminal).
- Identify lock metadata (who/when/operation).
- If a run is active, wait or stop it cleanly.
- If the lock is stale, coordinate and force-unlock only after confirming no active writers.
- Run a plan to confirm state consistency.
Decision points
- Active run present: do not force-unlock.
- Stale lock (no active run, old timestamp): force-unlock may be appropriate.
- Repeated lock issues: investigate backend connectivity and CI cancellation behavior.
Verification
- A new
terraform plancompletes successfully. - No concurrent runs are writing to state.
Rollback / undo
- If state becomes inconsistent, restore from backend versioning/snapshots.
- If a partial apply occurred, reconcile with a fresh plan and targeted remediation.
Escalation
- Escalate to platform/IaC owners if unlock requires backend admin privileges.
- Escalate if state corruption is suspected.
Examples
terraform plan