Skip to content

Infrastructure as Code

Infrastructure as Code (IaC) is the practice of provisioning and managing infrastructure using code rather than command-line tools or ClickOps GUIs. Beyond the mechanics of setting up systems, IaC is fundamentally about applying the principles, practices, and tools of software engineering to infrastructure — version control, code review, automated testing, and continuous delivery, all applied to the cloud.


Before IaC, infrastructure was managed manually. Servers were configured by hand, environments were documented in wikis that fell out of date immediately, and the difference between staging and production was tribal knowledge. Reproducing a broken environment took days. Recovering from a failure took longer.

IaC solves this by collapsing that gap between what should exist and what does exist:

BenefitWhat it means in practice
RepeatabilityThe same code, run twice, produces identical infrastructure. No more snowflake servers or “it works on my machine” environments.
ReusabilityModular building blocks can be shared across teams. One team’s battle-tested VPC module becomes everyone’s VPC module.
ShareabilityCode lives in Git — reviewable, forkable, versioned. Infrastructure decisions are documented by the commit that made them.
AuditabilityEvery infrastructure change has a commit, a PR, and a deployment record. Compliance questions become a git log.
Recovery speedEnvironments can be recreated from scratch in minutes. Disaster recovery becomes a pipeline run, not a multi-day manual operation.

IaC rests on three practices that define whether a team is actually doing IaC or just using a IaC toola:

  1. Define everything as code
  2. Continually test and deliver all work in progress
  3. Build small, simple pieces that can change independently

These aren’t best practices — they’re the baseline. Full detail in IaC Principles.

IaC is not one tool — it’s a stack of concerns, each layer handled by different tooling:

LayerWhat it managesGCP / Common tools
ProvisioningCreating and maintaining cloud resources (VMs, networks, databases, IAM)Terraform, Pulumi, Cloud Foundation Toolkit
Configuration managementWhat runs on existing servers after provisioningAnsible, OS Config, Cloud Init
Container orchestrationDeploying workloads to clustersGKE + Argo CD, Helm, Kustomize
CI/CDAutomating IaC changes through a delivery pipelineCloud Build, GitHub Actions, Atlantis
Policy enforcementValidating that all resources meet security and compliance standardsCheckov, OPA/Conftest, GCP Org Policy
ObservabilityDetecting when real infrastructure drifts from its declared stateterraform plan -refresh-only, Security Command Center

IaC and CI/CD are the same discipline applied to different artifacts — the pipeline validates and deploys infrastructure code the same way it validates and deploys application code. The critical difference is that infrastructure artifacts are stateful and slow to provision, which shapes every decision from test strategy to deployment sequencing. See IaC & CI/CD for the full pipeline setup.