Prompt
How do I troubleshoot drift detection in cloud infrastructure?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
To troubleshoot drift detection in cloud infrastructure, work from the symptom to the source of truth and then to the actual resource state.
1) Confirm what kind of drift you’re seeing
Common cases:
- Configuration drift: resource settings changed outside IaC
- Dependency drift: related resource changed and caused indirect mismatch
- State drift: IaC state file is stale or inaccurate
- Policy drift: deployment no longer complies with guardrails
2) Compare desired state vs actual state
Check three places:
- IaC definition: Terraform, CloudFormation, Bicep, Pulumi, etc.
- State/reconciler data: Terraform state, CloudFormation stack status, controller logs
- Cloud resource configuration: actual settings in AWS/Azure/GCP console or API
Useful approach:
- Run a plan/diff operation
- Inspect resource IDs, tags, IAM policies, networking rules, and versioned settings
- Verify whether the drift is a real config change or just a computed/default value difference
3) Validate the detection mechanism itself
If detection is missing or noisy:
- Ensure drift scanning is enabled and scheduled
- Confirm the tool has read permissions to all target resources
- Check whether resources are in supported services/regions
- Verify the scanner is using the correct account/subscription/project
- Review whether it ignores certain fields by design
4) Investigate recent changes
Look for:
- Manual changes in console
- CI/CD pipeline runs
- Auto-scaling or autosuggestion systems
- Operators/controllers modifying resources
- Cloud provider default updates or managed service changes
Review:
- Audit logs: AWS CloudTrail, Azure Activity Log, GCP Audit Logs
- Deployment logs
- Change tickets / incident records
5) Check for state synchronization issues
If IaC state is stale:
- Refresh or re-import resources
- Reconcile remote state with actual infrastructure
- Confirm no one edited state manually
- Check for locked or partially applied operations
6) Look for false positives
Drift detection often reports harmless differences due to:
- Defaulted values set by provider
- Computed fields
- Normalization/formatting differences
- Ephemeral metadata or timestamps
- Automatically managed fields
If so, compare the provider’s canonical API representation with your tool’s expectation.
7) Test remediation safely
Before fixing:
- Identify whether the resource is production-critical
- Use a staging environment if possible
- Determine whether remediation will recreate or replace resources
- Backup configs/data where needed
Then:
- Reapply IaC
- Import unmanaged resources
- Update code to reflect intentional changes
- Add ignore rules only for truly non-deterministic fields
8) Prevent future drift
Best practices:
- Make IaC the only path for changes
- Restrict console edits with IAM/RBAC
- Use policy-as-code and approval gates
- Schedule regular drift scans
- Alert on configuration changes from audit logs
- Document intentional exceptions
Quick checklist
- Confirm drift is real, not a false positive
- Compare IaC, state, and live resource config
- Check audit logs for who/what changed it
- Verify scanner permissions and scope
- Refresh/reconcile state
- Remediate or update code intentionally
- Add controls to prevent recurrence
If you want, I can also give you a tool-specific troubleshooting guide for Terraform, AWS CloudFormation, Azure, or Kubernetes drift detection.