Infrastructure as Code

Infrastructure as Code (IaC) is the practice of defining computing and network infrastructure through source code that can be treated like any other software system. In Martin Fowler’s words, it is “the approach to defining computing and network infrastructure through source code that can then be treated just like any software system.” Instead of an operator clicking through a console or running ad hoc commands on a server, the desired state of the infrastructure is written down in definition files.

Because the definition lives in files, it can be put under version control. This gives infrastructure the same benefits software code already enjoyed: a full audit trail of who changed what and when, the ability to review changes before they take effect, and the ability to reproduce an environment exactly from its definition. Fowler’s article stresses that these definition files act as self-documenting, precise, and consistent records of how a system is built, more reliable than human-executed runbooks.

The approach pairs naturally with deployment pipelines and automated testing. Small, incremental changes can be applied and verified continuously, making errors easier to detect and reverse than large manual batches. Techniques such as blue-green deployment let infrastructure be updated while keeping services available.

IaC became central to cloud computing, where the underlying resources are themselves provisioned through APIs. Tools in this category, such as HashiCorp’s Terraform, let practitioners describe the end state of cloud and on-premises resources declaratively; as the Terraform documentation puts it, the configuration files “describe the end state of your infrastructure” rather than the steps to reach it. This declarative, versioned, automated model is what distinguishes infrastructure as code from earlier scripting.