Two engineers on your team each run `terraform apply` simultaneously against the same remote state. What protects state from corruption?

Direct Answer (Verified)Reviewed by Sunny (Senior Cloud Engineer)

Correct Answer: State locking via DynamoDB (for S3 backend) or built-in locking (Terraform Cloud)

Remote backends like S3+DynamoDB and Terraform Cloud implement state locking. When one `apply` starts, it acquires a lock; subsequent operations block until the lock is released. T...

Real Exam Scenario

Two engineers on your team each run `terraform apply` simultaneously against the same remote state. What protects state from corruption?

✓ Correct Answer & Explanation

Correct Answer

State locking via DynamoDB (for S3 backend) or built-in locking (Terraform Cloud)

Why This Answer Is Correct

Remote backends like S3+DynamoDB and Terraform Cloud implement state locking. When one `apply` starts, it acquires a lock; subsequent operations block until the lock is released. There is no automatic merge of concurrent state changes — concurrent writes would corrupt state. Separate workspaces isolate state entirely but change the resource scope, not just access control.