ROOT // SYSTEMS
/ ROOT // SYSTEMS / INFRASTRUCTURE AS CODE

INFRASTRUCTURE AS CODE

Terraform didn't invent infrastructure automation. It changed the abstraction.

root@systems:~$ ls
./Terraform
./OpenTofu
./Ansible
./Packer
./cloud-init
./Declarative Infrastructure
./State
./Modules
./Immutable Infrastructure
./GitOps
INITIAL INDEX
01 / INFRASTRUCTURE AS CODE

Terraform

Terraform is a declarative infrastructure-as-code tool used to provision and manage infrastructure through configuration files. Resources are defined independently of the commands required to create them, while providers translate Terraform configurations into API operations against platforms such as AWS, Azure, Google Cloud, Kubernetes and other services. Terraform builds a dependency graph to determine resource relationships and execution order, allowing complex infrastructure to be planned, created, modified and destroyed in a controlled and repeatable manner.

02 / INFRASTRUCTURE AS CODE

OpenTofu

OpenTofu is an open-source infrastructure-as-code tool that originated as a fork of Terraform and maintains compatibility with much of the existing Terraform ecosystem. It uses declarative configuration, providers, modules and state to describe and manage infrastructure resources. OpenTofu is governed as an open-source project under the Linux Foundation and provides an alternative implementation for organizations that want an open-source infrastructure provisioning platform with Terraform-compatible workflows.

03 / INFRASTRUCTURE AS CODE

Ansible

Ansible is an automation and configuration-management platform that describes desired system state using human-readable YAML playbooks. It commonly connects to managed Linux and Unix systems over SSH and executes modules to perform tasks such as package installation, file management, user configuration and service control. Ansible emphasizes agentless operation and repeatable execution, while concepts such as inventories, roles, variables, handlers and idempotent modules allow automation to scale from individual servers to large infrastructure environments.

04 / INFRASTRUCTURE AS CODE

Packer

Packer is an image-building automation tool used to create consistent machine images from a single configuration. It can build images for platforms including cloud providers, virtual machines and containers, applying operating-system configuration, software installation and hardening steps during the build process. Packer separates image creation from infrastructure deployment, allowing Terraform, OpenTofu or other provisioning systems to deploy known, versioned images rather than configuring every machine from scratch.

05 / INFRASTRUCTURE AS CODE

cloud-init

cloud-init is a widely used initialization framework for cloud and virtual-machine instances. It processes metadata and user-provided configuration during the early stages of a system's first boot, allowing tasks such as creating users, configuring SSH keys, installing packages, writing files and configuring networking to be automated. It is commonly used alongside infrastructure-as-code tools to perform instance-level initialization after a machine has been provisioned.

06 / INFRASTRUCTURE AS CODE

Declarative Infrastructure

Declarative infrastructure describes the desired end state of a system rather than prescribing every individual operation required to reach that state. The provisioning engine determines the changes necessary to reconcile the existing environment with the declared configuration. This model allows infrastructure definitions to become version-controlled, repeatable and reviewable, while dependency graphs and reconciliation mechanisms can manage complex relationships between resources.

07 / INFRASTRUCTURE AS CODE

State

Infrastructure-as-code state records the relationship between declared resources and the real infrastructure managed by a provisioning system. In Terraform and OpenTofu, state commonly contains resource identifiers, attributes and dependency information used to determine what changes are required during subsequent operations. State therefore becomes a critical component of the infrastructure lifecycle and must be protected against loss, unauthorized modification and concurrent writes, particularly when shared infrastructure is managed by multiple engineers or automation systems.

08 / INFRASTRUCTURE AS CODE

Modules

Infrastructure modules package reusable infrastructure definitions into composable building blocks. A module can encapsulate resources, variables, outputs and dependencies behind a defined interface, allowing the same infrastructure pattern to be deployed consistently across environments or projects. Effective module design reduces duplication while establishing standards for networking, compute, security, Kubernetes clusters and other infrastructure components. Versioning modules independently also allows infrastructure teams to introduce controlled changes without modifying every deployment individually.