Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 110


What does state locking accomplish?

Show Answer
Correct Answer: C

State locking in Terraform blocks commands from modifying the state file to prevent multiple simultaneous writes, which could potentially corrupt the state. By ensuring that only one command can modify the state at a time, it maintains the consistency and integrity of the state file.

Discussion

11 comments
Sign in to comment
Uma10Option: C
Sep 1, 2022

If supported by your backend, Terraform will lock your state for all operations that could write state. This prevents others from acquiring the lock and potentially corrupting your state. Source: https://www.terraform.io/language/state/locking

chael88
Jan 29, 2023

Just passed the exam. There was a similar question not listed here on ExamTopic: What backend types supports state locking? A. local B. None C. All D. Some I chose D. Some as according to Hashicorp document: "Not all backends support locking" Source: https://developer.hashicorp.com/terraform/language/state/backends

phidelics
Mar 20, 2023

Not all backends supports state locking. you are right with option D

BurakkoOption: C
Sep 1, 2022

It just locks the state file not to be modified.

bora4motionOption: C
Sep 1, 2022

I go with C

barracoutoOption: C
Oct 12, 2022

I really wonder if exam topics needs to display the incorrect answers for legality purposes. It's C.

secdaddy
Dec 6, 2022

They're guessing at answers and then refining by croudsourcing answers from us

adoubanOption: C
Dec 12, 2022

C state locking is protect state file from modification at the same time

RVivekOption: C
Sep 26, 2022

Blocks Terraform commands from modifying the state file. Since already one command is doing a modification and mutiple simultaneous writes can make it inconsistant

legendary7Option: C
Sep 29, 2022

C-is the correct answer https://www.terraform.io/language/state/locking

asudhinOption: C
Oct 1, 2022

It's C

Power123Option: C
Mar 31, 2023

C is correct

Ni33Option: C
May 9, 2023

C is the right answer