liveBook · Manning

Infrastructure as code

As explained in Effective Platform Engineering

Infrastructure as code is the practice of defining and managing infrastructure through machine-readable configuration files and automation.

Infrastructure as code (IaC) defines and manages infrastructure configurations through code and automation. Keeping those definitions in version control makes provisioning repeatable, changes traceable, and collaboration easier. It also helps teams deploy consistently across development, staging, and production rather than allowing each environment to acquire its own configuration. section 10.3.1

For cloud infrastructure, prefer declarative configuration: specify the resource and its parameters rather than scripting every setup step. Cloud vendor APIs perform much of the underlying work from those parameters. Step-oriented tools still have a place when configuring a server requires imperative actions; they need not drive every cloud-resource change. section 6.3.4

Treat infrastructure definitions as maintained software, not merely files accepted by an IaC framework:

  • Keep shared infrastructure code DRY. Express the small differences between environments through parameters, such as Terraform tfvars, instead of copying code into folders or long-lived branches. section 6.3.3
  • Keep pipelines focused on triggers and ordering. Put reusable logic in versioned shared code or local scripts, and retrieve required credentials from a secrets manager rather than duplicating them in pipeline settings. section 6.3.3
  • Test reusable modules and intended resources, enforce conventions, and run recurring integration tests to catch manual changes made outside the pipeline. section 6.5

Provisioning across environments

A platform team defines cloud servers, databases, and networking in code, then uses automation to provision them across development, staging, and production. Version control records changes and supports rollback; consistent deployment reduces configuration drift. Terraform can define cloud resources, while Ansible remains an option for configuration tasks. section 10.3.1

Figure 6.10 Well-architected Infrastructure-as-code pipelines are no different from well-architected regular software pipelines. This is why we prefer the term “software-defined infrastructure” to differentiate between simply using an infrastructure-as-code (IaC) framework like Terraform and the software engineering practices that are a part of sustainable, high-quality software developer lifecycle management of an engineering platform product.
A screenshot of a diagram

AI-generated content may be incorrect.

The pipeline diagram highlights the distinction between adopting an IaC framework and applying software-engineering practices to the infrastructure delivery lifecycle. section 6.3.3

How Effective Platform Engineering covers it

How deep it goes
Explains declarative framework selection and gives pipeline, secrets, reuse, and testing practices without a complete implementation walkthrough.
Examples
Illustrates cloud servers, databases, and networking provisioned across environments, plus Terraform tfvars for environment-specific parameters.
What it assumes
Assumes familiarity with Git-triggered pipelines and cloud services while explaining why cloud infrastructure favors declarative configuration.
What you can do after
Apply it via Terraform to define cloud resources, then use pipelines and recurring tests to manage changes and detect drift.
How it connects
Connects infrastructure as code to CI/CD pipelines, version control, secrets management, declarative configuration, and configuration drift.

Also explained in

Compare how 14 books explain infrastructure as code →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Platform Engineering. The section links point to the parts of the book it draws on.