liveBook · Manning

Drift

As explained in Effective Platform Engineering

Configuration drift is the divergence between an infrastructure system's actual state and its declared or desired configuration.

Configuration drift occurs when infrastructure’s actual state no longer matches its desired configuration. A manual console change can cause it even when the infrastructure code has not changed. The mismatch may remain unnoticed until an unexpected change becomes a breaking change. section 6.3.5

Treat drift detection as part of the infrastructure pipeline, not as a one-time deployment check. Tests can provide a smoke check after deployment and run nightly to catch later changes made outside the pipeline. Consistent provisioning across development, staging, and production also reduces differences between environments, but does not remove the need to check their actual state. section 6.3.3 section 6.3.5 section 10.3.1

Check a required cloud setting

Suppose an AWS IAM role must exist and have the AdministratorAccess policy. An Awspec test can assert both conditions against the deployed configuration. If someone changes the role outside the pipeline, a recurring check can expose the mismatch. Write such tests against the intended outcome before implementing the infrastructure code; a test written afterward may merely confirm an assumption built into the implementation. section 6.3.5

require 'awspec'
describe iam_role('AdminUsersRole') do                   #1
  it { should exist }                                    #2
  it { should have_iam_policy('AdministratorAccess') }   #3
end

The Awspec listing shows assertions for a role’s existence and required policy—the kind of deployed-state checks that can be run repeatedly to detect drift. section 6.3.5

How Effective Platform Engineering covers it

How deep it goes
Explains manual-change causes and recurring configuration tests, but stops at detection rather than specifying automated repair.
Examples
Uses a console change to illustrate drift and an Awspec IAM role check to illustrate configuration testing.
What you can do after
Diagnose/debug with it by running recurring checks that compare deployed settings with required settings and flag unexpected changes.
How it connects
Connects configuration drift to infrastructure as code, integration testing, test-driven development, and continuous deployment.

Also explained in

Compare how 12 books explain drift →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Platform Engineering. The section links point to the parts of the book it draws on.