Module 1: Infrastructure as Code with Terraform

Lesson 1.2: Advantages of IaC

Plain language

Advantage What it means in practice
Version control Every change is a commit, so you have history, blame, and rollback by reverting the code.
Peer review Changes go through pull requests, and terraform plan shows reviewers exactly what will happen.
Repeatability and consistency The same code builds identical dev, staging, and prod environments, with no hand-built "snowflake" servers.
Reuse Modules package proven patterns once for many teams (Module 5).
Self-documentation The code is the record of what exists and how it's configured.
Speed and scale You can provision hundreds of resources in one run.
Drift detection Terraform can compare reality to code and surface changes made outside it (Module 6).
Automation and governance Runs can go through CI/CD or HCP Terraform with policy checks (Module 8).

Under the hood: mutable vs. immutable infrastructure

  • Mutable infrastructure: you patch and modify servers in place over time. Each server's history differs, and configuration drift builds up.
  • Immutable infrastructure: you replace a component with a new one built from the new definition, rather than modifying it. Terraform supports this pattern well. When an argument can't be updated in place, Terraform plans a replacement (-/+ in the plan). Module 4 covers how lifecycle controls the ordering.