DevOps Interview DropIntermediate TierScenario+25 XP on read

Two engineers run terraform apply at the same time against the same environment. What happens, and how do you prevent it?

#Terraform#IaC#State

Core Summary

Without locking, concurrent applies race on the state file and the last writer wins — silently orphaning real infrastructure. Remote state with a lock (S3 with native locking or DynamoDB, or Terraform Cloud) makes the second apply wait instead of corrupting.

Hints

Hint 1: State is the map from config to real resource IDs

Hint 2: The failure mode is silent, not a loud error

Hint 3: Locking is a property of the backend, not of Terraform itself

Reported in interviews at HashiCorp, Atlassian