Most Terraform pain is self-inflicted and predictable. Here are the mistakes we see most, and the fix for each.
Mistake 1: Local state on a laptop - use remote state with locking (S3+DynamoDB, TFC)
Fix: Remote, locked state; separate state per environment/component. Make it the default in your templates and enforce it in review or CI so the mistake cannot come back.
Mistake 2: Giant monolithic states that take minutes to plan and block the whole team
Fix: Pin provider and module versions; commit .terraform.lock.hcl. Make it the default in your templates and enforce it in review or CI so the mistake cannot come back.
Mistake 3: Running apply manually without reviewing the plan
Fix: Keep modules small and composable; review plans in the PR. Make it the default in your templates and enforce it in review or CI so the mistake cannot come back.
Mistake 4: Hardcoded secrets in .tf files instead of a secret manager
Fix: Use workspaces or directories, never edit prod state by hand. Make it the default in your templates and enforce it in review or CI so the mistake cannot come back.
A safer baseline
A minimal AWS example with remote state and a variable.
terraform {
required_providers { aws = { source = "hashicorp/aws", version = "~> 5.0" } }
backend "s3" {
bucket = "acme-tfstate"
key = "prod/network.tfstate"
region = "eu-west-1"
}
}
variable "env" { type = string, default = "prod" }
resource "aws_s3_bucket" "assets" {
bucket = "acme-${var.env}-assets"
tags = { Environment = var.env }
}Want senior help putting Terraform to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.