Configuration drift is the gradual divergence of a system's actual configuration from its intended state, for example the state defined in infrastructure as code or a baseline. It is caused by manual hotfixes, changes made outside the normal process, partial deployments and automatic updates. Drift makes environments inconsistent and hard to reproduce, causes failures that appear only in some places and can open security gaps.
What is configuration drift?
Configuration drift describes the moment when reality and the plan stop matching. A team defines how servers, cloud resources or Kubernetes clusters should look, for example in Terraform, Ansible or Helm charts. Over weeks and months, small changes pile up that never make it back into that definition: a firewall rule opened during an incident, a parameter tuned by hand on one database, a package updated on half of the hosts.
Each change may be harmless on its own. Together they create environments that look identical on paper but behave differently. Staging no longer predicts production, a rebuilt server misses a setting nobody documented, and a deployment fails on only three of twenty nodes.
Common causes
- Manual hotfixes: changes made directly in the console or on a host during an incident and never written back to code.
- Several tools managing the same resource: a Terraform module and a script, or two teams, both change the same setting.
- Partial or failed deployments: a rollout stops halfway and leaves some instances on the old configuration.
- Automatic changes: unattended package updates, autoscaling templates, cloud provider defaults that change over time.
- Snowflake servers: long-lived machines that are patched and adjusted for years instead of being rebuilt.
- Environment-specific overrides that grow until nobody knows which ones are intentional.
Why configuration drift matters
- Reliability: inconsistent configuration causes errors that occur only on some hosts or in one region, which are especially hard to diagnose.
- Security: a storage bucket made public for a quick test, a security group opened for debugging or a disabled audit log are classic drift with real risk.
- Reproducibility: disaster recovery depends on being able to rebuild an environment from code. Drift means the rebuilt environment is not the one that was running.
- Compliance: audits check the actual state, not the documented one.
- Failed automation: the next infrastructure run may overwrite the manual fix and bring back the original problem, or fail because the real state is unexpected.
How drift is detected
Drift detection compares the desired state with the actual state. With Terraform, a refresh-only plan shows differences between the state file and the real resources, and the -detailed-exitcode flag makes it usable in a scheduled pipeline:
# Exit code 0 = no changes, 1 = error, 2 = differences found
terraform plan -refresh-only -detailed-exitcode
In Kubernetes, kubectl diff -f manifests/ compares manifests with the live objects, and GitOps tools such as Argo CD or Flux continuously reconcile clusters with a Git repository and report resources that are out of sync. Cloud providers offer their own mechanisms, for example AWS Config rules or drift detection for CloudFormation stacks. Posture management tools look at the problem from the security side: they check the actual configuration of cloud accounts against rules, regardless of how it got there.
Preventing configuration drift
- Make code the only way to change infrastructure: infrastructure as code with reviews, and restricted write access in consoles.
- Write hotfixes back: every manual change during an incident gets a follow-up task, ideally recorded in the postmortem.
- Prefer immutable infrastructure: replace servers and containers instead of patching them in place.
- Run drift checks on a schedule, not only during deployments, and alert on differences.
- Reconcile automatically where it is safe, as GitOps controllers do, but be aware that automatic reconciliation also reverts emergency fixes.
- Keep monitoring configuration in code as well, following observability as code, because dashboards and alert rules drift too.
The observability perspective
Drift often first shows up in telemetry, long before anyone runs a drift check. One pod in a deployment with a different error rate, a host that reports a different agent or runtime version, or latency that differs by region without a code change are typical signs. Good observability makes these differences visible by keeping attributes such as version, environment, region and host on every metric, log and trace, so groups can be compared. During root cause analysis, the question "what changed?" should cover deployments and configuration changes alike, and a record of both shortens the search considerably.
How Obseria helps
Obseria does not offer a dedicated drift detection that compares infrastructure code with live resources. It covers both ends of the problem: IaC security checks Terraform, Kubernetes manifests and Dockerfiles in connected GitHub repositories for misconfigurations before deployment, and cloud security posture management continuously checks the actual configuration of cloud accounts against security rules with read-only access, including resources that were changed by hand. Detection rules on cloud audit logs can alert on risky changes, deployment tracking records releases next to the telemetry, and the audit trail shows who changed what in Obseria itself, such as alert rules and settings.