What is State Management?
State File (terraform.tfstate) = Terraform's memory of what it created
Stores:
- Resource IDs
- Current configuration
- Resource relationships
Local vs Remote State
Local State (Default)
project/
└── terraform.tfstate # Stored on your computer
Problems:
- Lost if computer crashes
- Can't share with team
- No backup
- Risk of conflicts if multiple people work
Remote State (S3 Backend)
State file → Stored in S3 bucket (cloud)
Benefits:
- Safe in cloud (won't lose it)
- Team can access