Tech_Interview_Prep

Infrastructure as Code

Defining infrastructure in version-controlled configuration instead of clicking through a console — reproducible, reviewable, and diffable.

What it is

Instead of manually clicking through a cloud console to create resources, Infrastructure as Code (IaC) tools (Terraform, CloudFormation, Pulumi) let you declare the desired end state of your infrastructure in a config file, and the tool computes and applies the diff between that and the current state.

Declarative vs. imperative

Most IaC tools are declarative — you describe what should exist ("a VPC with these three subnets"), not the step-by-step how. The tool figures out whether to create, update, or destroy resources to reach that state, which is what makes the config safely re-runnable.

Why it matters

  • Reproducibility — spin up an identical staging environment from the same config used for production.
  • Review — infrastructure changes go through the same pull-request review as application code, instead of an undocumented manual console change.
  • Drift detection — the tool can detect when the real infrastructure has been manually changed outside the config and no longer matches it.

Prerequisite

Assumes the networking vocabulary (VPCs, subnets) — that's typically the first thing defined in an IaC config, everything else is provisioned inside it.