Some backends support state locking, which prevents other users from modifying the state file while a Terraform operation is in progress. This prevents conflicts and data loss. Not all backends support this feature, and you can check the documentation for each backend type to see if it does.
Question 57
How is terraform import run?
Options:
A.
As a part of terraform init
B.
As a part of terraform plan
C.
As a part of terraform refresh
D.
By an explicit call
E.
All of the above
Answer:
D
Explanation:
The terraform import command is not part of any other Terraform workflow. It must be explicitly invoked by the user with the appropriate arguments, such as the resource address and the ID of the existing infrastructure to import. References = [Importing Infrastructure]
Question 58
Which of these actions are forbidden when the Terraform state file is locked? (Pick the 3 correct responses)
Options:
A.
terraform apply
B.
terraform state list
C.
terraform destroy
D.
terraform fmt
Answer:
A, B, C
Explanation:
When the state file is locked, operations that modify or depend on the state (like terraform apply, terraform destroy, and terraform state list) are blocked. terraform fmt only formats the configuration files and does not interact with the state, so it is allowed.