Terraform 1: What is IaC and why Terraform?
easy⏱ 5 mincourseterraform
Why Infrastructure as Code?
Instead of clicking to create resources, IaC declares them in text files. Terraform reads your .tf files, diffs desired-vs-actual state, and makes only the changes needed to converge. The files are reviewable in pull requests and reproducible across dev, uat and prod.
# Declarative — you describe the goal, not the click-by-click steps
resource "azurerm_resource_group" "orders" {
name = "myorg-orders-dev-rg"
location = "westus2"
}
Terraform vs ARM / Bicep / Pulumi
ARM templates are Azure-only JSON — verbose and hard to read. Bicep is a nicer Azure-only DSL that compiles to ARM. Pulumi lets you use real languages (TypeScript, Go) but couples infra to a runtime. Terraform uses HCL, is cloud-agnostic (thousands of providers), and keeps a state file to track what it manages. For multi-cloud or provider-rich setups, Terraform is the common default.
Declarative + state = idempotence
Because Terraform compares your files against recorded state, re-running an unchanged config is a no-op. You declare the end state once; Terraform figures out the create/update/delete steps. Running twice never doubles your infrastructure.
Model the IaC tool landscape
Create an iacTools map where each key is a tool (terraform, arm, bicep, pulumi) and each value is { language: string; cloudAgnostic: boolean }. Then log the names of the cloud-agnostic tools, comma-separated (Terraform and Pulumi qualify).