Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 26


When should you use the force-unlock command?

Show Answer
Correct Answer: C

The force-unlock command should be used when automatic unlocking of the state fails. This command is intended to manually release a lock that could not be released through regular automated processes, which can occur if a Terraform command was interrupted and the automatic unlocking did not happen. It should be used with caution as it may leave the Terraform state in an inconsistent state.

Discussion

9 comments
Sign in to comment
Egger1992Option: C
Nov 2, 2022

Be very careful with this command. If you unlock the state when someone else is holding the lock it could cause multiple writers. Force unlock should only be used to unlock your own lock in the situation where automatic unlocking failed. Source: https://www.terraform.io/language/state/locking

SilentMilliOption: C
Sep 12, 2023

The force-unlock command should be used when you need to manually release a Terraform state lock that cannot be released by other means. This command is typically used in scenarios where a Terraform command was interrupted, and the lock was not released automatically. Using the force-unlock command will forcibly release the lock, but it may leave the Terraform state in an inconsistent state, so it should be used with caution. Therefore, the correct answer is: C. Automatic unlocking failed

EltoothOption: C
Jan 6, 2023

C is correct answer. https://www.terraform.io/language/state/locking https://www.terraform.io/cli/commands/force-unlock

ceros399Option: C
Mar 16, 2023

answer is c

chimonsOption: C
Jun 19, 2023

C. Force unlock should not be used under normal circumstances

Ni33Option: C
Nov 1, 2023

C is correct

karendavtyanOption: C
Nov 5, 2023

C. Automatic unlocking failed

enookOption: C
Jul 3, 2024

C for sure

valli_Option: C
Apr 13, 2025

As unlocking might really be a great advantage and disadvantage. Keep in mind before using it!