Home » HashiCorp » Terraform Associate » Which of the below commands can be used to remove the already acquired lock on the state?
You are using a terraform operation that writes state. Unfortunately automatic state unlocking has failed for that operation. Which of the below commands can be used to remove the already acquired lock on the state?
A. terraform unlock
B. terraform force-unlock
C. terraform state unlock
D. None of the above
Correct Answer: B
Explanation/Reference:
Explanation:
Command: force-unlock
Manually unlock the state for the defined configuration.
This will not modify your infrastructure. This command removes the lock on the state for the current configuration. The behavior of this lock is dependent on the backend being used. Local state files cannot be unlocked by another process.
https://www.terraform.io/docs/commands/force-unlock.html
https://www.terraform.io/docs/state/locking.htmlTerraform has a force-unlock command to manually unlock the state if unlocking failed.
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.
Topic 3, Exam Set C
Download Printable PDF. VALID exam to help you PASS.
|
|