Skip to content
Technology transformation expertise firm · ARDIANE Group Innovate, secure, succeed

Glossary

Infrastructure as code (IaC): definition, approaches and tools

Domain

Cloud and platforms

In brief

Infrastructure as code (IaC) consists of describing an IT infrastructure (networks, servers, databases, access rights) in versioned files, which a tool applies to create or modify the resources. A term of common usage, infrastructure as code replaces manual operations with changes that can be reviewed, traced and replayed.

Page contents

Definition of infrastructure as code

Infrastructure as code, abbreviated to IaC (sometimes translated in French as infrastructure en tant que code), consists of describing an IT infrastructure in versioned text files, then letting a tool create or modify the resources based on these files. Networks, virtual machines, clusters, databases, access rights or DNS entries are described in this way.

The term is one of common usage. It is among the technical practices grouped under the word DevOps.

What changes when infrastructure is described in files

Without this practice, a resource is created by hand, in a console or by commands entered one by one. Its state is then only known by inspecting what exists.

With versioned files, an infrastructure change takes the form of a modification proposed in a repository. It can be reviewed before being applied. The history shows who changed what and when. An environment can be recreated from the repository, and another built on the same model.

The counterpart is discipline. A change made by hand, outside the files, creates drift: the description and what exists no longer match.

Declarative approach, imperative approach and tools

Common usage distinguishes two approaches. In the declarative approach, the files describe the target state, and the tool works out the operations that lead to it. In the imperative approach, they list the operations to be executed, in order. The boundary is not watertight.

Tool What its documentation says
Terraform An infrastructure as code tool with declarative configuration files. It draws up an execution plan, submitted for approval, and tracks the actual infrastructure in a state file
OpenTofu An infrastructure as code tool described in the same terms: declarative configuration, execution plan, state file
Pulumi An infrastructure as code platform that uses general-purpose programming languages (TypeScript, Python, Go, .NET, Java) or YAML. Its engine works out the operations that lead to the desired state expressed by the program
Ansible An open source, agentless automation tool. Its YAML scripts, the playbooks, declare the desired state of a system
AWS CloudFormation A service in which a template describes the AWS resources to be provisioned
Bicep A language with declarative syntax for deploying Azure resources, converted at deployment into an Azure Resource Manager JSON template

According to the Pulumi documentation, a program is written in a general-purpose language and yet expresses a desired state: the language used is therefore not enough to place a tool in one of the two approaches.

Infrastructure as code, GitOps, delivery pipeline: not to be confused

Infrastructure as code concerns the description of resources. GitOps refers to a way of applying a state described in this manner: according to the principles published by the OpenGitOps project, software agents automatically pull the desired state from its versioned source, continuously observe the actual state and attempt to apply the desired state.

The integration and deployment pipeline is where the files are checked and then applied. The security checks carried out there on infrastructure code fall under DevSecOps.

Finally, platform engineering is an organisation: a dedicated team offers self-service capabilities, which infrastructure as code modules can implement.

Example: a network rule added through a reviewed change

Take a team that needs to allow a new flow to a database. It adds the rule to the file that describes the network and proposes the change in the repository. The tool, of the declarative type, produces a plan: one rule to create, nothing else to modify. A second person reviews the plan, then the delivery pipeline applies it.

Later, this rule is widened by hand in the console, during an incident. The next plan, drawn up from what exists and from the files, reveals the gap. The team then chooses to carry the change over into the files or to restore the described rule.

Shared modules, change review and drift detection are presented on our page on DevOps and platform engineering.

FAQ

Frequently asked questions

Another question? Ask us

What is infrastructure as code?

Infrastructure as code, abbreviated to IaC, consists of describing an infrastructure (networks, servers, databases, access rights) in versioned files, then entrusting a tool with creating or modifying the resources based on these files. An infrastructure change becomes a file modification, which can be reviewed and traced like a modification to application code.

What is the difference between the declarative and the imperative approach?

In the declarative approach, the files describe the target state of the infrastructure, and the tool works out the operations that lead to it. In the imperative approach, the files list the operations to be executed, in order. This distinction is one of common usage and is not watertight: the same tool may borrow from both approaches.

What is configuration drift?

Configuration drift is the gap that appears between the infrastructure described in the files and the actual infrastructure, for example after a change made by hand in a cloud provider's console. As long as this gap is neither detected nor resolved, the files no longer faithfully describe what exists. The fix consists of carrying the change over into the files or restoring the described state.

What is the difference between infrastructure as code and GitOps?

Infrastructure as code concerns the description of resources in versioned files. GitOps concerns the way a state described in this manner is applied: according to the principles published by the OpenGitOps project, software agents automatically pull the desired state from its versioned source, continuously observe the actual state and attempt to apply the desired state. An organisation can practise the first without the second.

Does infrastructure as code only concern the cloud?

No. The Terraform documentation, for example, states that the tool manages cloud resources as well as on-premises resources, and also higher-level elements such as DNS entries or SaaS features. The principle applies to resources that a programming interface allows to be created and modified.

A project to bring to completion?

A first conversation is enough to understand your challenge, identify the right people and tell you frankly what we can bring.