What Infrastructure as Code is

Manage infrastructure like source code.

Beginner12 min · lesson 1 of 23

Infrastructure as Code (IaC) is the practice of defining your servers, networks, databases, and cloud resources in version-controlled text files, then letting a tool create and update the real infrastructure to match. Instead of clicking through a cloud console to make a server — a process nobody remembers and nobody can repeat exactly — you write what you want in a file, review it like code, and apply it. The infrastructure becomes reproducible, reviewable, and auditable, exactly like software.

The IaC loop
1write
describe infra in code
2review
pull request, like software
3apply
tool creates/updates real resources
4repeat
change the code, re-apply
The code is the source of truth. The running infrastructure is derived from it — not the other way around.

Why it changed everything

Manual infrastructure has three chronic problems IaC solves. Reproducibility: a console-built server cannot be recreated identically, but a file can be applied a hundred times to a hundred environments. Drift and documentation: the code IS the documentation, always current, because the infrastructure is built from it. And review and audit: every change is a diff in version control, so you can see who changed what, review it before it ships, and roll back by reverting a commit. Infrastructure gains all the discipline software already had.

Provisioning vs configuration

Two related jobs fall under IaC, and it helps to separate them early. Provisioning is creating the infrastructure itself — the servers, networks, load balancers, databases (Terraform’s job). Configuration management is setting up what runs on those servers once they exist — installing packages, writing config files, starting services (Ansible’s job). Many real setups use both: Terraform builds the machine, then Ansible configures it. This course covers both, and the tools for each.

The console is for looking, not for changing
The cardinal rule once you adopt IaC: stop making changes by hand in the console. A manual change creates "drift" — the real infrastructure no longer matches the code, so the next apply may revert your change or behave unpredictably, and your source of truth is now a lie. Use the console to observe and debug; make every change through the code. A team half-committed to IaC, still clicking in the console "just this once," gets the worst of both worlds.