TA-002-P · Question #170
TA-002-P Question #170: Real Exam Question with Answer & Explanation
The correct answer is D: Enable terraform state locking for the S3 backend using DynamoDB table. This prevents. {"question_number": 6, "correct_answer": "D", "explanation": "The correct fix is to enable state locking on the S3 backend using a DynamoDB table. When configured, Terraform will acquire a lock entry in DynamoDB before any terraform apply or terraform plan (that writes state), an
Question
You have multiple developers working on a terraform project (using terraform OSS), and have saved the terraform state in a remote S3 bucket . However ,team is intermittently experiencing inconsistencies in the provisioned infrastructure / failure in the code . You have traced this problem to simultaneous/concurrent runs of terraform apply command for 2/more developers . What can you do to fix this problem?
Options
- AUse terraform workspaces feature, this will fix this problem by default , as every
- BStructure your team in such a way that only one individual will run terraform apply ,
- CStop using remote state , and store the developer tfstate in their own machine . Once a
- DEnable terraform state locking for the S3 backend using DynamoDB table. This prevents
Explanation
{"question_number": 6, "correct_answer": "D", "explanation": "The correct fix is to enable state locking on the S3 backend using a DynamoDB table. When configured, Terraform will acquire a lock entry in DynamoDB before any terraform apply or terraform plan (that writes state), and release it when done. If another developer tries to run simultaneously, they will be blocked until the lock is released, preventing race conditions and state corruption. Workspaces don't prevent concurrent runs on the same workspace. Relying on a single person is a process workaround, not a technical fix. Storing state locally would remove shared state visibility entirely.", "generated_by": "claude-sonnet", "llm_judge_score": 5}
Topics
Community Discussion
No community discussion yet for this question.