Other meanings of Infrastructure as Code
CLOUD COMPUTING & DEVOPS
Infrastructure as Code (IaC) is the practice of defining, provisioning, and changing computing infrastructure through machine-readable files rather than manual console operations. IaC applies software-engineering methods such as version control, review, testing, and repeatable deployment to networks, virtual machines, databases, containers, and cloud services.
Infrastructure as Code treats infrastructure configuration as a managed software artifact. Engineers describe desired resources, relationships, and settings in files that an IaC tool interprets to create or modify an environment. The approach can cover a single virtual machine or an entire multi-region platform, including identity, networking, storage, observability, and managed services.1
The normal workflow stores these definitions in a version-control system, reviews proposed changes, and applies them through a repeatable command or delivery pipeline. This creates an auditable history and reduces dependence on undocumented manual steps. IaC is closely associated with DevOps, but it is also used by infrastructure, security, data-platform, and research-computing teams.
IaC tools either describe the desired end state or prescribe the steps needed to reach it. A declarative configuration states that specified resources, properties, and relationships should exist; the tool compares that model with the real environment and calculates changes. Terraform and OpenTofu are prominent examples of this model, although many platforms combine declarative files with procedural hooks.15
Imperative approaches instead encode an ordered sequence of actions, often through scripts or general-purpose programming languages. They can express complex control flow, but repeated execution requires careful handling of partial failure and idempotence. Declarative systems do not eliminate procedural logic: providers, modules, startup scripts, and configuration-management tools may still perform imperative work inside a broader desired-state workflow.
Templates and modules add reuse, while variables and environment-specific inputs allow one definition to serve development, testing, and production without copying entire configurations.
Reliable IaC depends on an accurate representation of both intended and actual infrastructure. Many declarative tools maintain a state file or comparable inventory that maps configuration objects to provider resources; it helps determine whether an object must be created, updated, replaced, or removed.1
When someone changes a resource outside the IaC workflow, the environment can develop configuration drift. A plan or reconciliation step can expose that divergence, but teams must decide whether to adopt the manual change, revert it, or revise the source configuration. Shared state requires access control, encryption, backups, and locking where supported. Secrets should generally be supplied through dedicated secret-management systems rather than committed to repositories.
Production delivery commonly separates planning from approval and applies changes through automated pipelines. Policy checks, static analysis, isolated test environments, and staged rollouts reduce the risk of destructive or overly broad changes.23
IaC is also a governance and recovery practice, not merely a faster provisioning method. A complete repository can document dependencies, expose ownership, support reproducible disaster recovery, and make the differences between environments visible. Cloud teams may use policy as code to reject disallowed regions, public storage, weak encryption, or excessive permissions before deployment.
Several edge cases require special treatment. Import workflows bring pre-existing, manually created resources under management; replacement operations can cause downtime or data loss; and provider version changes can alter defaults or resource behavior. Ephemeral environments created for a branch or pull request can shorten testing cycles, but they need automated expiration to prevent cost accumulation. IaC can also manage hybrid estates that combine cloud services, on-premises systems, SaaS resources, and Kubernetes objects, although different tools may be needed for each layer.24
The boundary between IaC and GitOps is not fixed: GitOps emphasizes reconciliation from a version-controlled source, while IaC more broadly includes any code-centered definition and automation of infrastructure.
IaC tools differ in syntax, execution model, state handling, and provider support; practices that are safe for one platform may require adaptation on another.
Help improve the encyclopedia. Reports go straight to the site manager.