At two in the morning somebody widened an inbound rule in a console to unblock an install. The change worked, the release went through, and nobody copied it back into the definition. Weeks later a fresh environment came up with the old rule and the same failure. The drift began with a repair that made complete sense at the time.

Config is whatever varies between deploys

The 12-Factor page, a methodology article with no static version checked on 2026-11-26, defines config as everything likely to vary between deploys, including credentials for external services and the hostname of each deployment. It treats strict separation of config from code as a requirement and offers a sharp test: the codebase should be open-sourceable at any moment without leaking credentials. Internal application config that does not vary between deploys belongs in code. Config files kept outside version control beat constants, but they scatter and invite accidental commits. Environment variables are the preferred mechanism because they are fine-grained and orthogonal.

One boundary deserves care. That page counts external service credentials as config and recommends environment variables for them. Managing secrets in a dedicated system follows a different classification scheme, and the two rules should not be merged. This discussion stays with non-secret configuration.

The same page argues against grouping config into named environments such as development, test, staging, qa, production and personal variants. Its phrase is combinatorial explosion of config: every new environment multiplies the values that must be kept aligned. Each deploy should manage its own variables instead.

Kubernetes draws a narrow box around ConfigMap

In Kubernetes documentation v1.37, a ConfigMap is an API object holding non-secret key-value data, meant to decouple environment-specific configuration from the container image. The documentation states plainly that ConfigMap provides no secrecy or encryption; secret data belongs in a Secret or another tool. Size is capped at 1 MiB. The immutable field is available from v1.19, and Immutable Secrets and ConfigMaps reached Stable in v1.21. Marking an object immutable cannot be undone; the object has to be deleted and recreated. Immutability guards against accidental edits and offers no confidentiality guarantee.

The change that never made it back

HashiCorp's drift detection tutorial, vendor material with Terraform v1.4+ as a prerequisite and no static version, checked on 2026-11-26, places the origin of drift outside the workflow. Resources may depart from the expected state after a service outage or degradation, a certificate expiry, or a manual change by someone else. Its demonstration edits a security group inbound rule in the console, and the live configuration no longer matches the workspace state file. Calling that pattern a helpful hotfix describes the intent behind the edit, a writing angle rather than a phrase from the tutorial, and it makes no claim about how often such repairs produce drift.

The tutorial separates two checks. Drift detection compares actual infrastructure settings with the workspace state file; continuous validation checks whether resources still satisfy checks defined in the configuration. The evaluation uses a refresh-only plan that changes neither state nor configuration. Workspace support for drift detection begins at Terraform 0.15.4+ and continuous validation at 1.3.0+. Those are product thresholds from the tutorial, not universal rules.

Two remedies follow. When the manual change should be kept, update the configuration first, then run apply to bring the state file into line. When it should be undone, run apply to overwrite the change. Drift detection reports only attributes present in the configuration, so important attributes deserve to be written explicitly even when a provider would supply a default.

Where the change came fromHow it becomes visibleWhat closes the loop
Console edit during an incidentDrift detection against the state fileUpdate the configuration and apply, or apply to overwrite
Certificate expiryDrift detection or continuous validationRenew and reapply the declared resource
Provider default left implicitOnly if the attribute is written in configurationAdd the attribute, then apply
Change by another writerReview the diff before applyAccept the difference and let the patch write it

What declarative management lets through

Kubernetes object management documentation v1.37 distinguishes three approaches: imperative commands, imperative object configuration and declarative object configuration. The page warns that mixing approaches on the same object produces undefined behavior. With declarative configuration, kubectl detects create, patch and delete for each object, and kubectl diff previews the outcome before kubectl apply.

The patch API writes only the difference observed at that moment. That is why declarative management preserves changes made by other writers to the live object, even when those changes were never merged back into the configuration file. The cost is real: merges and patches are harder to reason about, and the result is harder to debug. Consistency remains a property the team has to audit.

Before the next incident

Separating config from code makes the definition the source of truth. Keeping non-secret values out of images and writing declarations detailed enough for a diff to mean something completes the picture. An emergency edit that never gets copied back is a loan taken against the next environment rebuild.

Cross Mini App treats drift detection as part of keeping its shared runtime predictable across deployments.

Sources