Use this when defining the authoritative intended configuration for drift checks.
Desired State · Drift Management
Desired state in drift management is the authoritative definition of how systems should be, kept in Git or a source of truth, against which actual state is measured.
1. Desired state is the reference for drift.
2. Version-controlled.
3. Per environment.
4. Reviewed.
5. Kept current (update when legitimate changes happen).
git/SoT → desired state
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 Verification path Verify boundary
Verification starts with a non-mutating comparison such as a refresh-only plan or equivalent read/diff. Record the configuration revision, state/workspace identity, remote resource identity and the exact attributes reported as different. Determine whether each difference is expected, computed, authorized or actionable. After choosing adopt or revert, perform the controlled change and run the same drift check again; it should be clean for the properties you own. Also verify the consumer-visible service behavior because a drift-free infrastructure object can still be operationally unhealthy. For recurring checks, compare results over time and ensure detection itself does not write state in a way that destroys the evidence of what changed. The verification output should support a human decision, not turn every difference into automatic remediation.
Step 2 Common mistakes Narrow the fault
- Desired state in several places.
Step 3 Where it fails Narrow the fault
The main boundaries are desired configuration, automation state/inventory, provider read semantics and remote system state. A difference between configuration and state is not the same as a difference between state and remote infrastructure, and either can be caused by an intentional migration. Another boundary is ownership: a field controlled by another system should not be forcibly reconciled by this workflow. Do not run an apply simply because a detector says 'drift'; first show which model changed and whether that change was authorized. State repair, configuration update and remote mutation are different remediations with different risk. Preserve the original diff before changing any of them. Re-run the same detection path after correction and verify that only the intended ownership set is converged.
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.
- Lives in Git or a source of truth.
- Must be reviewed.
- Is the reference for all comparisons.
- Declared state in git/SoT — authority
- Version used for comparison — reference
- Environment-specific values — per env
ReferenceWhy it matters1 section · depth on demand
In depth
In drift management, desired state is the reference that drift is measured against — the rendered configuration, the playbook or the IaC definition at the deployed version. It must be versioned so you know which desired state a system should match.
| Question | Answer from |
|---|---|
| What should this device have? | Rendered config at the deployed Git commit |
| Since when? | Deployment record |
| Who approved it? | Pull request/change record |
If the desired state itself is wrong, fix it through the normal review process rather than accepting the drift silently.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
Drift management is a three-model problem: desired configuration expresses intent, a state/inventory model records what the automation believes it manages, and the remote system has actual current values. Drift exists when the managed actual state diverges from the intended or recorded model, but the cause matters: an operator may have changed the resource out of band, a provider may normalize defaults, an external controller may own the same property, or the desired repository may legitimately be behind an approved emergency change. Desired state is the reference used to decide whether a difference should be adopted or reverted; it is not automatically 'correct' merely because it is committed. Effective drift management therefore couples detection with ownership and change intent, not with unconditional auto-remediation.
ReferenceConfiguration & state1 section · depth on demand
Lifecycle
Run drift detection on a cadence appropriate to the rate and risk of change, using read-only refresh/plan mechanisms where available. Preserve the exact desired revision and state/workspace identity used for comparison, and classify differences before applying anything. If the remote change is authorized and should persist, update the desired configuration through normal review and then reconcile state. If it is unauthorized or accidental, converge the resource back to desired state after assessing impact. Avoid simultaneous controllers with overlapping ownership, and maintain ignore/normalization rules narrowly so noisy computed fields do not hide real drift. Track recurring drift as a process/design signal: manual bypasses, missing automation coverage, unstable provider fields or unclear ownership often cause repeated differences.
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 > Desired State. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.hashicorp.com/terraform/tutorials/state/resource-drift · confidence 94%Quick lookup tables
Drift Management → Desired State · operational reference
Context-specific ownership, verification, output and failure-boundary lookup for Drift Management → Desired State.
| Layer | Drift Management → Desired State operational reference |
|---|---|
| Context identity | Terraform / declarative IaC current + exact revision/input/target identity |
| Persistent intent | Versioned contract/configuration with explicit ownership and prerequisites |
| Verification | Validate inputs/read current state → exercise bounded operation → independent target read-back |
| Output contract | Preserve structured status/IDs/properties before human formatting |
| Failure boundary | Separate source/input/engine/controller execution from downstream target outcome |
Deep reference
Healthy vs suspicious evidence
Output interpretation
Useful drift output is a structured change set: resource address/ID, attribute path, prior recorded value, observed remote value, proposed reconciliation direction and whether the field is computed or explicitly configured. A generic 'N changes' summary is insufficient for deciding whether to adopt or revert. Preserve plan/assessment artifacts with the desired revision and timestamp, but redact secrets. Distinguish drift from a normal desired-state change: the former originates outside the reviewed intent path, while the latter is expected because configuration itself changed. If provider normalization creates persistent no-op-like diffs, document and fix that modeling issue rather than teaching operators to ignore all changes on the resource. After remediation, retain the clean comparison plus independent service check as closure evidence.