TA-002-P · Question #26
When should you use the force-unlock command?
The correct answer is C. Automatic unlocking failed. terraform force-unlock should only be used when automatic unlocking has failed - meaning a previous Terraform run crashed or was interrupted, leaving a stale lock in the backend that did not get released automatically. It should not be used simply because you cannot acquire a…
Question
When should you use the force-unlock command?
Options
- AYou see a status message that you cannot acquire the lock
- BYou have a high priority change
- CAutomatic unlocking failed
- DYour apply failed due to a state lock
How the community answered
(63 responses)- A2% (1)
- B3% (2)
- C89% (56)
- D6% (4)
Explanation
terraform force-unlock should only be used when automatic unlocking has failed - meaning a previous Terraform run crashed or was interrupted, leaving a stale lock in the backend that did not get released automatically. It should not be used simply because you cannot acquire a lock (another operation may be legitimately running), because you have a high-priority change (never a valid reason to bypass safety), or because an apply failed (the lock is typically released on failure). Misusing force-unlock when another process is actively running can corrupt state.
Topics
Community Discussion
No community discussion yet for this question.