Terraform describes infrastructure as declarative HCL, builds a dependency graph, and shows a plan of exactly what will change before it applies - across AWS, Azure, GCP and hundreds of providers.
Why teams use it
- Every infrastructure change is reviewed as code in a pull request
- terraform plan shows the diff before anything is touched
- One workflow and language across clouds and SaaS providers
Install it
brew install terraform # or download the binary from releases
terraform -install-autocomplete
terraform versionA first working 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 }
}Run and verify
terraform init
terraform fmt -recursive && terraform validate
terraform plan -out tfplan
terraform apply tfplanMistakes to avoid early
- Local state on a laptop - use remote state with locking (S3+DynamoDB, TFC)
- Giant monolithic states that take minutes to plan and block the whole team
- Running apply manually without reviewing the plan
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.