TA-002-P · Question #81
What features stops multiple admins from changing the Terraform state at the same time?
The correct answer is D. State locking. State locking is the feature that prevents multiple administrators from simultaneously modifying the Terraform state file, thereby avoiding conflicts and corruption. This mechanism ensures only one operation can write to the state at a time.
Question
What features stops multiple admins from changing the Terraform state at the same time?
Options
- AVersion control
- BBackend types
- CProvider constraints
- DState locking
How the community answered
(25 responses)- A8% (2)
- C4% (1)
- D88% (22)
Why each option
State locking is the feature that prevents multiple administrators from simultaneously modifying the Terraform state file, thereby avoiding conflicts and corruption. This mechanism ensures only one operation can write to the state at a time.
Version control helps track changes to configuration files, but it does not directly prevent concurrent writes to the active Terraform state file itself.
Backend types determine where the state file is stored and how it's accessed, but specific backends enable state locking; the type itself is not the feature.
Provider constraints define the acceptable versions of providers, which is unrelated to managing concurrent state access.
State locking is a crucial feature provided by Terraform backends that prevents concurrent operations from modifying the state file, which could lead to data corruption or inconsistent infrastructure. When an operation starts, the state is locked, and subsequent operations must wait until the lock is released.
Concept tested: Terraform state locking
Source: https://developer.hashicorp.com/terraform/language/state/locking
Topics
Community Discussion
No community discussion yet for this question.