Why should Terraform state never be committed to Git?
BeginnerProductionState and Backends in Production
Answer
State holds secrets in plaintext, has no locking, and merge conflicts on a JSON file with a serial number are a recipe for corruption. In production we use a remote backend with locking, encryption and versioning, and .gitignore all *.tfstate* files.
More on State and Backends in Production
How 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?AdvancedHow do you split a monolithic state and what drives blast-radius decisions?Advanced