Two engineers applied at the same time from laptops with local state. How do you recover?
AdvancedProductionState and Backends in Production
Answer
Duplicate resources or conflicting state files are likely. Stop all applies, collect both terraform.tfstate files, and decide the truth by inspecting the cloud. Import resources missing from the chosen state and delete duplicates created by the other apply. Then migrate to a remote backend with locking and move apply into CI so this cannot recur.
More on State and Backends in Production
Why should Terraform state never be committed to Git?BeginnerHow do you bootstrap the remote backend, given the bucket must exist before Terraform can use it?IntermediateWhat does a hardened S3 state bucket look like?IntermediateWhat is the minimum IAM permission set for the S3 backend?IntermediateHow do you move from DynamoDB locking to S3 native locking in a live fleet?IntermediateState was deleted or corrupted. How do you recover?Advanced