Terraform state for small teams
1 min read
On this page
Terraform state maps your configuration to real resources. Losing it, or editing it concurrently, is how small teams end up with orphaned infrastructure.
Store state remotely
terraform {
backend "s3" {
bucket = "my-team-tfstate"
key = "prod/terraform.tfstate"
region = "ap-southeast-1"
use_lockfile = true
}
}Lock every run
Locking prevents two terraform apply runs from writing state at the same time.
