Demos and production are different sports. This checklist covers what changes when Terraform has to be reliable, secure and observable under real load.
Security and reliability defaults
- Scan with tfsec/Checkov in CI to catch open security groups and public buckets
- Pull secrets from Vault/SSM at apply time instead of committing them
- Restrict the CI role with least-privilege IAM for the apply step
A production-minded config
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 }
}Operational best practices
- Remote, locked state; separate state per environment/component
- Pin provider and module versions; commit .terraform.lock.hcl
- Keep modules small and composable; review plans in the PR
- Use workspaces or directories, never edit prod state by hand
In production, boring and reproducible beats clever every time.
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.