What is the difference between infrastructure as code and configuration as code, and how does that difference show up in the kinds of tools a team ends up running?
answer
- what exists versus how it is set up
- control-plane API versus into the machine
- configuration management came first
- images and SaaS settings blur the line
- the handoff is where problems live
basics
~20 sInfrastructure as code declares the resources themselves — networks, machines, managed services. Configuration as code declares the state inside or on top of them, such as installed packages, files and services. The two overlap but answer different questions.
solid answer
~50 sInfrastructure as code is about *what exists*: the network, the machine, the managed database, the DNS record. Configuration as code is about *how something already existing is set up*: which packages are installed on a host, what is in a config file, which service is enabled. Historically they came from different worlds — configuration management arrived first, for estates of long-lived servers, and cloud provisioning tools followed once the machines themselves became API objects. In practice most teams run both, or run one tool for provisioning and hand off to another for the inside of a host, because the primitives differ: one talks to cloud control-plane APIs, the other connects to a machine and asserts conditions on it. The line blurs in two directions: immutable delivery pushes host configuration into the image build, and "configuration as code" increasingly covers settings in SaaS products, DNS and alerting, which are declared through provider APIs just like infrastructure.
go deeper
Be able to sort examples into the right bucket: creating a virtual machine or a managed database is provisioning, while installing a package or writing a config file on that machine is configuration. Say that both live in version control.
Explain why the tooling split exists — different unit of work, different thing to authenticate to — and describe the common estate shape where one tool provisions and another configures, with a handoff between them.
Discuss the handoff as the real problem: inventory generation, ownership of shared values, and what happens when a provisioner replaces a machine. Explain how immutable image builds change where the configuration work happens.
Own the estate-level decision: how many tool categories the organisation should run, where the authoritative source for each class of setting lives, and how far to extend declaration into SaaS and platform settings before the cost of modelling exceeds the benefit.
## Two questions, not one - **Infrastructure as code** answers *what exists*. A virtual network with this address range. Six machines of this size. A managed database with this engine version. A load balancer in front of them. The unit of work is a cloud (or platform) resource, and the tool talks to a control-plane API. - **Configuration as code** answers *how an existing thing is set up*. This package at this version is installed. This file has these contents. This service is enabled and running. This kernel parameter has this value. The unit of work is the state of a system, and the tool typically connects into that system to assert conditions. Both are "declare it in a reviewed file in version control rather than doing it by hand". They differ in what they are declaring about. ## Why the split exists historically Configuration management came first, and it came from a world of long-lived servers. Someone racked a machine; the question was how to get a hundred of them into a consistent state, and to keep them there as packages and settings changed. That is a per-host, in-band problem. Cloud provisioning tools arrived when the machine itself became an API object. Suddenly the network, the firewall, the disk and the machine were all things you could create and destroy with a call, and the question shifted from "how do I configure this server" to "which servers, and what else, should exist at all". The two problems are genuinely different, and that is why the tooling ended up different: one authenticates to a cloud control plane and manages resource records, the other authenticates to a machine and manages its innards. ## How it shows up in practice A very common estate shape is: a provisioning tool creates the network, the machines and the managed services; a configuration-management tool then brings each machine to the required software state; and something in between — an instance's user-data, a bootstrap hook, or an inventory generated from the provisioner's outputs — passes the handoff. That handoff is where the interesting problems live. Which tool owns a value that both need? How does the configuration tool learn about a machine that the provisioner just created? What happens when the provisioner replaces a machine — does the configuration tool notice, or does it keep converging a host that no longer exists? ## The line blurs in two directions **Downward, via immutable delivery.** If host state is baked into an image before launch and running machines are never modified, then at run time there is no per-host configuration work left; the estate is pure provisioning, and the configuration-as-code work has moved into the image build pipeline. Many teams still use a configuration-management tool for exactly that — as the thing that configures the image being built, rather than the fleet in production. **Upward, into anything with an API.** "Configuration as code" is now applied well beyond servers: dashboards and alert rules, DNS zones, identity groups, feature-flag definitions, SaaS product settings. These are declared through provider APIs and are, mechanically, indistinguishable from infrastructure resources — which is why provisioning tools have absorbed a lot of this ground. If it has an API and you want it reviewed and reproducible, it can be declared. ## The distinction that actually matters in an interview Do not present this as a taxonomy quiz. The useful framing is: 1. **The unit differs** — resource records versus in-system state — and that determines what the tool must authenticate to and what it can observe. 2. **The lifecycle differs.** Provisioned resources are typically created and destroyed; configured state is typically converged repeatedly over the life of something long-running. 3. **Both need the same disciplines regardless** — version control, review, repeatable application, and a way to see what a change will do before it happens. A weak answer treats the two terms as marketing labels for the same thing, or claims one tool category has made the other obsolete. Containers, for instance, did not delete the configuration problem; they moved most of it into the image definition and left a residue — the host running the container runtime, and the platform configuration around it — that still has to be declared somewhere. ## The phrase's third meaning Be aware that "configuration as code" is also used, especially by application developers, to mean *application* configuration kept in version control and delivered by a pipeline rather than typed into a console. That is a legitimate third sense of the phrase. If it comes up ambiguously in an interview, it is entirely reasonable to ask which sense they mean rather than guessing.
- If the team moves to immutable images, does configuration as code disappear?No — it moves. Instead of converging a running fleet, the same declarations configure the image at build time, so the work shifts from production hosts into the build pipeline. What genuinely shrinks is per-host convergence in production and the drift that comes with it. Some residue always remains: the host running the runtime, and the platform configuration around the workloads.
- What is the hardest part of running a provisioning tool and a configuration tool side by side?The handoff. The configuration tool needs to learn about machines the provisioner just created, which means either generating its inventory from the provisioner's outputs or discovering hosts dynamically. Ownership of shared values is the other half: if both tools can set the same thing, decide which one is authoritative and make the other read it, or you get two sources of truth that quietly disagree.
- The phrase "configuration as code" is used ambiguously. What are the senses worth separating?Two mainly. In the operations sense it means declaring system state — packages, files, services — in reviewed files applied by a tool. In the application sense it means application settings kept in version control and delivered by a pipeline rather than edited in a console. They share the discipline but not the mechanism, and it is fair to ask which one an interviewer means.
saying these in an interview costs you the question
- Infrastructure and configuration tools do the same job with different syntax
- Containers made configuration management entirely obsolete
- Configuration as code only ever means files on a server
- One tool must own both provisioning and host configuration
- Storing a YAML file in git is configuration as code by itself