Your Terraform state isn't safe
Hi,
There's one file in every Terraform project that can ruin your week: the state file.
It's the record of which real resources your code created. Lose it, and Terraform forgets your infrastructure exists. It tries to create everything again, or you spend days importing resources by hand.
Three mistakes cause most state disasters.
1. State lives on one laptop.
The default is a local terraform.tfstate file. One dead disk, one accidental delete, or one teammate who can't see your latest changes, and you're in trouble.
Move it to a remote backend. On AWS that's an S3 bucket, and terraform init -migrate-state copies your existing state across.
2. Two applies at the same time.
You and a teammate run terraform apply together. Both read the same state, both write, and the last one wins. That's how state gets corrupted.
Turn on locking. Newer Terraform versions can lock directly in S3 with one line: use_lockfile = true. No DynamoDB table needed.
3. No versioning, no encryption.
State can hold secrets in plain text: database passwords, keys, tokens.
Enable versioning on the bucket so you can roll back a bad write, turn on encryption, and block all public access. Then practise restoring an old version once, before you need it.
Remote. Locked. Versioned.
The full post, with the Terraform for each fix: Terraform state: store it, lock it, recover it
Ship safely,
Umar

P.S. Not sure where your state lives or who can read it? Hit reply, or grab a Free AWS Review and I'll take a look.