Skip to main content
Technical Systems

Configuration Drift: Comparing Intended State With What Is Running

Distinguish legitimate variation from unmanaged change, then reconcile according to ownership and consequence.

Investigate configuration drift through explicit baselines, precedence, effective runtime values, infrastructure state, exceptions, and safe reconciliation across deployments.

Configuration Drift: Comparing Intended State With What Is Running

A release works on most application instances, but a few continue calling an old endpoint. The deployment completed successfully. One group of processes retained an earlier environment value, and an incident override on another group took precedence over the new file.

The problem is not necessarily different code. It is the gap between the intended configuration and the configuration actually used. A repository can describe the new endpoint while running processes continue making decisions under another value.

Configuration drift is divergence from an applicable intended baseline. It does not mean every difference between staging and production is wrong. Environments often need different capacity, credentials, and service destinations. The task is to make those differences deliberate, attributable, and reproducible.

Establish the Baseline and Its Owner

A baseline needs a scope and a version. It may describe infrastructure resources, deployment settings, application configuration, or runtime policy. These are connected layers, but one source file rarely describes all of them completely.

Identify which system owns each setting. Infrastructure code may own a database resource, a secret manager may own a credential version, and a feature service may own a targeting rule. Putting every value into one repository is neither necessary nor appropriate, especially for secret material.

Specify allowed variation too. Production may deliberately have more replicas than staging, and an autoscaler may legitimately adjust replica count within an agreed policy. Comparing all observed values with one fixed snapshot can generate false alarms unless the comparison understands those ownership rules.

An approved baseline can also be wrong. Drift detection asks whether reality matches the declared intention; testing and review ask whether the intention is suitable. A perfectly reconciled endpoint value can still point at the wrong service.

Trace How the Effective Value Is Chosen

An application may load defaults, a configuration file, environment variables, command-line arguments, a remote store, and temporary overrides. The order and refresh behaviour depend on the framework and application. Establish that actual precedence before deciding which edit will change behaviour.

A file on disk may differ from the value loaded in memory. Some settings require a restart, some refresh dynamically, and some are read only when a client or connection pool is created. A successful configuration deployment does not establish that all consumers have switched.

Retain suitable evidence of the loaded configuration version and load time. For secrets, record identifiers or approved version metadata rather than logging the values. A naive hash of a low-entropy secret can also expose information, so avoid treating a digest as automatically safe diagnostic output.

Group observations by instance, deployment, region, or tenant as appropriate. An overall dashboard saying version 12 is active can conceal the small population still running version 11. This is the distinction between intended activation and reader state also examined in runtime strategy configuration.

LayerIntended-state evidenceRuntime evidence to compare
InfrastructureVersioned resource declarationProvider-observed resource properties
Application deploymentRelease manifest and approved settingsRunning image and loaded version
Secret referenceApproved secret identifier or versionReference actually resolved
Feature policyPublished rule set and target scopeRule version used for a decision
Temporary exceptionApproved scope and expiryInstances still applying the override

Distinguish Missing Values From Explicit Choices

Omitting a setting, setting it to an empty string, and selecting a documented default can have different meanings. A framework upgrade may change a default while every explicit configuration file remains unchanged. Capture important effective defaults in release verification rather than assuming an unchanged file guarantees unchanged behaviour.

Deletion also needs a contract. Removing a key from a remote store may restore an application default, retain a cached value, or cause an error, depending on the reader. Test the intended removal path and record which consumers must refresh or restart. Otherwise a cleanup operation can create a new divergence that ordinary value comparisons miss.

Compare the Right Representations

Infrastructure tools commonly maintain state that connects declared resources with provider-managed objects. That state is important, but it is not interchangeable with the configuration that declares the intended result or with the live resource itself.

HashiCorp’s Terraform drift tutorial demonstrates detecting changes made outside Terraform and deciding whether to update the declaration or change the resource. Applying a refresh-only plan updates recorded state to reflect observed objects; it does not by itself edit the declaration to approve the new behaviour.

Comparison needs semantic rules. Providers can apply defaults, platforms can add generated fields, and controllers can legitimately change properties within their remit. Exclude or interpret those differences deliberately rather than suppressing a growing list of unexplained alerts.

Coverage also has limits. A detector cannot report properties its provider or integration does not observe. It may see the deployment’s environment variable without seeing which value a long-running process cached. Record what the check actually covers so a clean result is not treated as a complete runtime audit.

Follow the Lifecycle of Emergency Changes

An incident override can be a justified response to restore service. The drift problem arises when that change is left without an owner, expiry, or route back into the intended configuration. The next deployment may remove a necessary mitigation or leave inconsistent populations running indefinitely.

Record what changed, why, where it applies, and who will resolve it. After the incident, decide whether to adopt the value in the baseline, replace the mitigation with a proper fix, or restore the previous setting. Reconciliation should implement that decision rather than simply favouring whichever value is older.

Include the effect of refresh and restart. Removing an override from a store may not remove a client already built with that value. A recovery plan needs to verify the effective state after the change, not stop at a successful edit or deployment event.

Test rebuilding a representative instance from the approved sources. If it needs an undocumented console change to operate, the system is not yet reproducible from those sources. That exercise often reveals dependencies more clearly than another round of documentation alone.

Reconcile According to Consequence

Kubernetes controllers illustrate a control-loop model that observes state and works toward a desired state. That model is useful when ownership and actions are well defined. It does not imply that every difference in a production estate should be overwritten automatically.

Restoring an instance label and replacing a database are different operations. Evaluate the planned action, including deletion, recreation, downtime, and data effects. A tool reporting drift does not determine which consequence the organisation has authorised.

Automatic correction can suit bounded, well-tested settings. More consequential differences may need investigation or approval through the existing change process. The distinction should follow the actual operation and session authority rather than a blanket rule that all drift always requires manual intervention.

Avoid competing reconcilers. If an autoscaler, deployment tool, and incident script repeatedly overwrite the same property, each can appear locally correct while the system oscillates. Assign ownership and describe how one mechanism hands control to another.

Reconciling an effective configuration difference
Reconciling an effective configuration difference No Yes Versioned baseline and allowed variation Observe effective runtime state Compare under ownership rules Unexpected difference? Continue monitoring Investigate cause and consequence Approve the appropriate correction Update baseline or runtime state
The approved decision can restore runtime state or update the baseline; observation alone does not choose between them.

Keep Deployment and Rollback Compatible With State

A release can change the meaning of a setting while keeping its name. A timeout unit may change, or a previously optional field may become required. Validate configuration against the application version that consumes it, including old and new instances during a rollout.

Store an appropriate release record linking image, schema, configuration, and relevant policy versions. A claim that two instances run identical code does not establish identical behaviour if they interpret different configuration or data states. The evidence needs to identify the combination that actually ran.

Rollback requires the same attention. Restoring an old binary with a new configuration format can fail differently from the original release. Reverting a setting also cannot undo a completed payment or previously disclosed data. Keep configuration recovery connected to business-effect reconciliation where necessary.

Test a partial rollout and recovery path. Check which consumers refresh automatically, which need replacement, and what happens when the configuration service is unavailable. These are observable behaviours, not properties established merely by storing configuration as code.

Make Drift Findings Useful to Operators

Prioritise differences by consequence and scope. An unexpected public access setting can require a different response from a harmless generated annotation. Alert descriptions should identify the baseline, observed property, affected resource, and responsible owner so the operator can act without rediscovering the whole model.

Track repeated causes as well as individual differences. Frequent manual edits may reveal an impractical deployment process; stale readers may indicate missing refresh reporting; competing controllers may reveal unclear ownership. Closing the individual alert without addressing that cause leaves the system likely to drift again.

The strongest evidence is a system that can be reconstructed, inspected, and corrected through known processes. Production validation can then examine the remaining runtime assumptions without depending on undocumented differences. Configuration becomes manageable when intended state and effective state are both visible, and the route between them is deliberate.