Use this when scheduling comparisons between actual and desired state.
Drift Detection · Drift Management
Drift detection in drift management runs scheduled comparisons — terraform plan, Ansible check mode, GitOps diff, config backups compared in Git — and flags any differences.
1. Drift detection on schedule or continuously.
2. Check mode, refresh-only plans, GitOps status, compliance scans.
3. Alert on important drift.
4. Low noise.
5. Store results.
schedule → compare → drift findings
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verify drift detection with a controlled field change and restored no-drift state Verify boundary
Verify Drift Detection in a safe target by capturing a known no-drift baseline with result No drift for one object, making one controlled reversible field change and expecting exactly that field to appear as drift with the correct desired and actual values. Restore the desired value, collect fresh actual state, repeat the drift scan and expect result Success with the diff cleared. Confirm the report records desired revision and observation time. A clear drift report shows the comparator saw no difference in covered fields, but it does not show uncollected state is compliant.
Step 2 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as stale actual state, noisy computed fields, wrong identity match, over-broad ignore rules, concurrent changes and remediation creating new drift, choosing the cases most relevant to scheduled/event-driven desired-versus-actual reads, normalized diff, ignored fields, freshness and creating a reviewable drift record before remediation.
Step 3 Branch drift faults at desired revision, observation, normalization and comparison policy Narrow the fault
If Drift Detection reports an unexpected difference, verify it loaded the intended desired revision and the same target identity before changing anything. If desired state is correct, inspect the raw observed value and observation timestamp. If raw values are equivalent but the diff remains, inspect normalization, defaults and ignored/computed fields. If drift disappears intermittently, compare collection consistency and eventual convergence. Reproduce one field diff from raw desired and actual values through the comparator.
Step 4 Common mistakes Narrow the fault
- Detection intervals too long.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Use terraform plan, check mode or GitOps diff to detect drift.
- Run detection on a schedule.
- Alert when drift is found.
ansible-playbook site.yml --check --diff— CM driftterraform plan -refresh-only— IaC driftargocd app list | grep OutOfSync— GitOps drift
ReferenceWhy it matters1 section · depth on demand
Drift detection compares normalized desired state with independently observed actual state
Drift Detection requires two trustworthy inputs: desired state from an authoritative revision and actual state collected from the managed system. The detector owns the comparison process and depends on both desired-state and observation providers. Normalization matters because ordering, defaults and computed values can create false differences. The detector owns comparison logic, not the source systems. Record desired revision, observation timestamp, object identity and normalization rules so a reported diff can be reproduced. A zero-drift result is only as strong as the observation coverage and freshness.
ReferenceImportant terms & boundaries1 section · depth on demand
Method
Drift detection compares actual and desired state automatically and reports differences.
1. Choose the method per platform: ansible --check --diff, terraform plan -detailed-exitcode, config diff tools, DSC Test-DscConfiguration.
2. Schedule it (daily or more often for critical systems).
3. Filter known volatile differences.
4. Report results to owners and track counts over time.
5. Treat detection failures (unreachable targets) as findings too.
terraform plan -detailed-exitcode -no-color > plan.txt; rc=$?
# 0 = no drift, 2 = drift, 1 = error
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Drift Management > Drift Detection. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://developer.hashicorp.com/terraform/tutorials/state/resource-drift · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For scheduled/event-driven desired-versus-actual reads, normalized diff, ignored fields, freshness and creating a reviewable drift record before remediation, prefer typed fields and stable IDs over human presentation text.