Bookmarks

Configuration drift

Divergence between the actual state of infrastructure and what its description or code records: manual tweaks, emergency changes and forgotten updates accumulate over time.

Also: config drift, configuration divergence

checked 9 Nov

All terms

Infrastructure is increasingly described as code — Terraform, Ansible, Kubernetes manifests — with the expectation that the description matches reality. But servers live a life of their own: an engineer opens a console and raises a memory limit, a database administrator applies a patch, an automation script changes a firewall rule. Each change is harmless on its own; together they add up to configuration drift.

Where drift comes from

CauseExample
Manual changesan engineer changes a setting in the cloud web console without touching the code
Emergency fixesduring a night-time incident the configuration is edited directly, and porting the change back to the repository is later forgotten
Scripts and agentsa local script, a cron job or an auto-update utility quietly changes files and packages
Urgent security updatesa patch is applied to some servers — some nodes get the new version while others stay on the old one
Copied environmentsstaging and production were deployed at different times from different versions of the description

Why it’s dangerous

The main risk is that drift goes unnoticed. The on-call engineer believes one version of the service is deployed, while three of the twelve nodes run an older one. A new engineer runs the command from the documentation and it behaves unexpectedly, because the actual server has long since diverged from it. Drift also complicates disaster recovery: rebuilding an environment from code yields a configuration that did not exist at the time of the failure.

consoleTerraform shows that the instance type was changed outside the code
$ terraform plan -refresh-only Note: Objects have changed outside of Terraform   # aws_instance.example has been changed~ instance_type = "t2.micro" -> "t3.large" Terraform has detected a change outside the code; a plain apply would revert the machine to t2.micro.

How drift is found and resolved

  • Detection: comparing the live infrastructure with the description — for Terraform this is terraform plan -refresh-only.
  • Accepting changes: if the edit is needed, it is added to the code; if not, the code is applied again and the edit is rolled back.
  • Prevention: manual changes to production are forbidden, and all changes go through the repository and the CI/CD pipeline.

Immutable infrastructure and GitOps guard against drift: an agent continuously compares the actual state with the desired state in Git and brings deviations back in line with the description. In fast-moving systems drift never disappears entirely — it is made visible and kept under control.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • IaCInfrastructure as Code

    IaC is the approach of describing infrastructure as code; configuration drift is its typical problem, when reality departs from the code.

  • immutable infrastructure

    Immutable infrastructure rules out drift: a server is not edited after deployment but replaced with a new image.

  • GitOps

    GitOps continuously removes drift: an agent compares the system with Git and brings it back to the described state.

In depth in the references

where the topic is covered in detail