Why this matters
Remote, locked state prevents concurrent writes and corruption during team applies.
Configure a remote backend with state locking (e.g., S3 + DynamoDB table or AzureRM blob with leases). Do not use local backend for shared environments.
Remote, locked state prevents concurrent writes and corruption during team applies.
Side-by-side examples engineers can pattern-match during review.
terraform {
backend "local" {
path = "./terraform.tfstate"
}
}
terraform {
backend "s3" {
bucket = "org-tf-state"
key = "prod/network/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "tf-state-locks"
encrypt = true
}
}
backend "s3" { dynamodb_table = "tf-state-locks" }backend "local" { path = "state.tfstate" }From the same buckets as this rule.