Declarative infrastructure, state, and the ways it goes wrong.
2 items · all topics
Two engineers run terraform apply at the same time against the same environment. What happens, and how do you prevent it?
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 the first one's work.
Two engineers changed the same Terraform file and Git reports a conflict. How do you resolve it?
Resolve the text conflict, then prove the result is actually correct with terraform validate and a plan. A clean Git merge only means the file parses in a human's head, it says nothing about whether the merged config destroys a database.