When you see a status message stating that you cannot acquire the lock.
The Answer Is:
C
This question includes an explanation.
Explanation:
Detailed Explanation:
Rationale for Correct Answer: The terraform force-unlock command is used to manually remove a state lock only when Terraform fails to release it automatically. This situation typically occurs due to interruptions (e.g., crashed process, network failure) that leave the state locked. Terraform’s locking mechanism prevents concurrent operations, so force-unlock should be used cautiously and only when you are certain no other process is actively using the state.
Analysis of Incorrect Options (Distractors):
A. When apply has failed due to a state lock. Incorrect because failure alone does not justify force-unlock; the lock may still be valid and held by another process.
B. When you have a high-priority change. Incorrect because urgency does not justify bypassing Terraform’s locking mechanism.
D. When you see a status message stating that you cannot acquire the lock. Incorrect because this usually means another process is currently holding the lock; force-unlock should not be used unless you are sure the lock is stale.
Key Concept: Terraform state locking and safe use of force-unlock to recover from stale locks.