Services

Resources

Company

IaC (infrastructure as code)

Infrastructure as code (IaC) is the practice of defining infrastructure, such as networks, virtual machines, databases and IAM (identity and access management) policies, in text files instead of console clicks. The files live in version control, go through code review and are applied by a tool such as Terraform. The same code can rebuild the same environment repeatedly.

How it works

You declare the resources you want. The tool compares that declaration with a state file that records what it created earlier, and with the real cloud APIs. It then computes a plan. For example, terraform plan might report Plan: 3 to add, 1 to change, 0 to destroy. terraform apply executes that plan and updates the state. Modules let teams reuse one VPC (virtual private cloud) or cluster definition across dev, staging and production.

Why it matters in production

IaC makes infrastructure changes reviewable, repeatable and reversible. It cuts the drift between environments that causes "works in staging" incidents. It also makes disaster recovery faster, because a lost environment can be recreated from code. State files need protection, since they can hold secrets and a corrupted state blocks every change.

See also

On the One2N blog

References

  1. What is Terraform? (HashiCorp developer docs)

Four-panel comic explaining Infrastructure as code. Infrastructure as code is the practice of defining servers, networks and cloud resources in versioned files that a tool applies automatically.