Infrastructure as Code
In plain English
Plain definition
Infrastructure as Code (IaC) means describing the servers, networks, storage and other computing infrastructure your systems need in text files, instead of clicking through a console or running ad hoc commands by hand. Those files are stored, reviewed and applied the same way software source code is: through version control, peer review and automated tooling.
How a tool turns definitions into infrastructure
Infrastructure resources (compute instances, networking, storage, identity policies and platform configuration) are represented as declarative or imperative definitions in a machine-readable language. A control plane or tool reads these definitions and reconciles the described (desired) state against the actual state of the target environment, creating, modifying or removing resources to bring reality into alignment. Declarative tools (for example Terraform, CloudFormation, Pulumi in declarative mode) specify the desired end state and delegate ordering and change calculation to the tool. Imperative tools (for example many Ansible playbooks or shell-based provisioning scripts) specify the sequence of operations to reach that state. Most mature IaC workflows combine both: declarative resource provisioning with imperative configuration management layered on top.
Why teams manage infrastructure this way
IaC underpins repeatable environment creation, disaster recovery, change auditing and drift detection. Because definitions are stored as code, changes can go through the same review, testing and approval gates as application code: pull requests, automated plan/diff output, policy checks and staged rollout. This materially reduces configuration drift between environments and gives the team a traceable record of who changed what, when, and why. It also means that recovering an environment after a failure can, in principle, be reduced to re-applying known-good definitions, provided state data and secrets are also managed correctly.
Where IaC fits in a platform
IaC works at the provisioning and configuration layer of a platform’s architecture. It typically interacts with three other layers: the underlying provider APIs (cloud provider, hypervisor or hardware orchestration APIs) that it calls to create and mutate resources; a state or inventory layer that records what has been provisioned (a state file, API-backed state store, or the live environment itself for stateless imperative tools); and a delivery layer (CI/CD pipelines, GitOps controllers) that triggers IaC execution on a defined event, such as a merged change. IaC does not replace runtime configuration management or application deployment. It is commonly paired with configuration management tools and application release tooling to cover the full lifecycle from bare resource to running service.
Reviewing a plan before adding an instance
A team defines a virtual network, three compute instances and a load balancer in a declarative configuration file. When someone proposes a change, such as adding a fourth instance, the IaC tool computes a plan describing exactly what will be created, modified or destroyed, and presents that plan for review before anything is applied:
Plan: 1 to add, 0 to change, 0 to destroy.
+ compute_instance.web[3]
id = (known after apply)
instance_type = "m5.large"
subnet_id = "subnet-0a1b2c3d"
The reviewer checks the plan output against the intended change before approval, rather than trusting an unverified manual action performed directly against the live environment.
Code does not make a change safe
IaC is not inherently safe simply because it is code. IaC definitions can still describe destructive or insecure changes, and the tool will faithfully execute whatever the definition specifies, including deleting resources or opening broad network access, unless separate safeguards such as plan review, policy-as-code checks, state locking and least-privilege execution credentials are also in place. Writing infrastructure as code changes how changes are expressed and reviewed; it does not by itself guarantee correctness, security or recoverability. Configuration management (maintaining state on already-running systems) is also often confused with IaC (provisioning the systems themselves). The two are complementary but address different lifecycle stages.
Terms that come up alongside IaC
- Configuration Management
- Declarative Provisioning
- GitOps
- State Drift
- Policy as Code
Further Reading
Refer to the KBY Technologies Infrastructure as Code technology reference for platform-specific documentation and current tooling guidance. Because tool behaviour, default permissions and provider APIs change between releases, confirm the specific tool version and permission model in use before relying on version-specific operational detail.
Related reading
Authoritative Sources
About this page
Credited to
Dates
Published
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Recommended reading
More from KBY that goes with this term.

