DFdom@fradley
← ~/writing
$ cat what-is-infrastructure-as-code.md

Infrastructure as Code, explained: why serious Azure teams stopped clicking around

In the Azure portal, click Create a resource and make a storage account. A minute later it exists, and you learnt how Azure configures one. Now make a second one with identical settings, from memory. Or work out, six months on, what you changed on the first.

You can't reliably repeat clicking, and you can't easily see what you did.

The shift

Infrastructure as Code (IaC) means you describe your infrastructure in a file, and a tool makes Azure match that description. Say you want a storage account with certain settings in a certain region. You write that down and run a command. The tool compares the file with what exists and creates whatever is missing. If everything already matches, running it again changes nothing. Pointed at a fresh subscription, the same file builds the same environment there.

reads what exists the difference only main.tf the state you want plan compare the two, work out the gap Azure the state that exists run it again and nothing happens
You describe the end state. The tool compares it with what exists and applies only the difference.

Because the setup is a file, it can go through pull-request review (a teammate checks the change before it goes in), sit in version control with a history of what changed and why, and be rebuilt from the file if the environment is lost.

The tools

Bicep is Azure's own IaC language, and the easiest place to start. Terraform works across clouds and has a large ecosystem, which is why many platform teams use it. ARM templates are the original JSON format; Bicep compiles down to the same engine. All three work from the same idea: you state the end result and the tool gets Azure there.

Where it goes

Once the infrastructure is code, you can test it, reuse it and automate it. At larger scale teams use it for policy, security guardrails, cost control and landing zones (a pre-built, governed Azure setup that workloads are deployed into). The gap between a working demo and a governed platform is large, and that gap is most of what I do for a living.

A first exercise: define one small resource in Bicep or Terraform, delete it, and deploy it again from the file.

discuss on linkedin → more writing