Question 1 · choose 1
A team using a backend that supports locking asks whether they must acquire the state lock themselves before running terraform apply. What is the answer?
- AYes; they must run terraform force-unlock -lock before each apply
- BYes; they must add a lock block to the terraform block of the configuration
- CNo, because state locking only applies to terraform destroy operations
- DNo; it is locked automatically for operations that could write it
Show the answer and why
AYes; they must run terraform force-unlock -lock before each apply
Incorrect
force-unlock removes a lock; nobody runs it to take one.
BYes; they must add a lock block to the terraform block of the configuration
Incorrect
There is no lock block; locking is a backend feature used automatically.
CNo, because state locking only applies to terraform destroy operations
Incorrect
Every operation that could write state is locked, not just destroy.
DNo; it is locked automatically for operations that could write it
Correct
State locking happens automatically on all operations that could write state, without any message unless acquiring the lock takes a while.
Locking is automatic and silent; you notice it only when someone else holds the lock.
HashiCorp documentation