1. What is Terraform State?
- A file (
terraform.tfstate) that stores the current status of your infrastructure.
- Terraform uses it to
- Track resources
- Know what exists
- Plan changes
- Prevent accidental recreation
2. Why Do We Need Remote State?
Local state issues:
- Can be deleted accidentally
- Not sharable in teams
- Risky: contains sensitive info
- No locking → two “terraform apply” = chaos 😭
Remote state solves this by giving:
- Central storage
- Collaboration
- Locking
- Encryption
- Versioning (optional)
3. AWS S3 as a Terraform Backend
S3 bucket = place to store terraform.tfstate