πŸ“ Tutorials

What is Terraform? A Simple Explanation for Developers


Terraform is an infrastructure-as-code tool. Instead of clicking around in the AWS/GCP/Azure console to create servers, databases, and networks, you write code that describes what you want, and Terraform creates it for you.

resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t3.micro"
  tags = { Name = "my-web-server" }
}

Run terraform apply, and Terraform creates an EC2 instance. Run it again β€” nothing happens (it’s already there). Change the instance type and run again β€” Terraform updates it. Delete the code and run again β€” Terraform destroys it.

Why infrastructure as code

Without IaC: you click through the AWS console, create 15 resources, forget what you configured, can’t reproduce it, and your coworker has no idea what’s running.

With Terraform: your infrastructure is in Git. It’s versioned, reviewable, reproducible, and documented. You can spin up an identical environment in minutes.

How it works

  1. Write .tf files describing your infrastructure
  2. terraform plan β€” shows what will change (preview)
  3. terraform apply β€” creates/updates the resources
  4. terraform destroy β€” tears everything down

Terraform tracks what it created in a state file, so it knows the difference between what exists and what you want.

Providers

Terraform works with 3,000+ providers β€” AWS, GCP, Azure, Cloudflare, GitHub, Datadog, Vercel, and more. Each provider gives you resources to manage:

# AWS
resource "aws_s3_bucket" "files" { bucket = "my-files" }

# Cloudflare
resource "cloudflare_record" "www" {
  zone_id = "abc123"
  name    = "www"
  value   = "1.2.3.4"
  type    = "A"
}

Terraform vs. alternatives

ToolLanguageCloud supportBest for
TerraformHCLAll cloudsMulti-cloud, most popular
CloudFormationJSON/YAMLAWS onlyAWS-only shops
PulumiPython/TS/GoAll cloudsDevs who prefer real languages
CDKTypeScriptAWS (mainly)AWS + TypeScript teams

When to use Terraform

Good fit: managing cloud infrastructure, multi-cloud setups, teams that want reproducible environments, anything beyond a single server.

Overkill for: a single VPS, hobby projects on Vercel/Netlify (they handle infra for you), or if you only use one cloud and prefer its native tools.

For the full command reference, see the Terraform cheat sheet.