Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Detect and remediate infrastructure drift between IaC definitions and live state with continuous monitoring and automated remediation.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-09 | ✗→✓ | ▲ Improved | 115% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 241% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 230% | 0% |
| case-21 | ✗→✓ | ▲ Improved | 84% | 0% |
| case-24 | ✗→✓ | ▲ Improved | 225% | 0% |
Trigger this skill when:
Outputs: Drift detection report with changed resources, remediation plan with impact analysis, compliance status, optional auto-remediation execution with audit trail.
Time normalization:
NOW_ET = 2025-10-25T21:30:36-04:00 (NIST/time.gov semantics, America/New_York, ISO-8601)Input validation:
Source freshness:
Abort conditions:
Scope: Single stack/workspace, on-demand drift check, common 80% case
terraform plan -refresh-only -detailed-exitcode to preview state refreshaws cloudformation detect-stack-drift --stack-name <name> then poll DescribeStackDriftDetectionStatuspulumi refresh --preview-only to compare desired vs actualdriftctl scan --from tfstate://<path> --to <provider> for multi-resource scanjson { "drift_detected": true, "tool": "terraform", "timestamp": "NOW_ET", "drifted_resources": 3, "severity": "high", "resources": [ {"id": "aws_security_group.web", "change": "ingress_rules_modified", "severity": "high"} ], "recommended_action": "revert" }
Token budget: ≤2k (state comparison, basic drift report)
Scope: Multiple stacks, scheduled detection, compliance reporting, semi-automated remediation
cloudformation-stack-drift-detection-check for automated compliancedriftctl scan --filter "Type=='aws_s3_bucket'" for resource-type scopingyaml remediation_plan: strategy: semi-automated steps:
resource: aws_security_group.web reason: Unauthorized ingress rule added (port 22 from 0.0.0.0/0) severity: high method: terraform apply approval: required
resource: aws_instance.app reason: Instance type upgraded via console (approved change ticket CHG-123) severity: low method: terraform import + update code approval: auto
resource: aws_s3_bucket.logs reason: Tags modified by automation (exemption EXEMPT-456) severity: low method: add lifecycle ignore_changes approval: auto estimated_duration: 15min rollback_plan: "terraform state backup + manual revert if apply fails"
--auto-approve (if fully-automated) or prompt for approvalToken budget: ≤6k (multi-stack scan, impact analysis, remediation plan, notifications)
Authoritative sources used:
When to revert drift vs accept drift:
Remediation approval thresholds:
Escalation triggers:
Abort conditions:
Required fields:
typescriptinterface DriftDetectionOutput { timestamp: string; // ISO-8601, NOW_ET tool: "terraform" | "cloudformation" | "pulumi" | "driftctl"; scope: string; // stack/workspace name or "all" drift_detected: boolean; drifted_resources: number; resources: DriftedResource[]; severity_summary: { high: number; medium: number; low: number; }; remediation_plan?: RemediationPlan; compliance_impact?: string[]; // Array of violated controls trend?: { drift_frequency: string; // "increasing" | "stable" | "decreasing" most_drifted_resources: string[]; }; audit_log_id?: string; // Reference to remediation execution log } interface DriftedResource { id: string; // Resource identifier type: string; // Resource type (aws_security_group, etc.) change_type: "added" | "modified" | "deleted"; severity: "high" | "medium" | "low"; changed_attributes: { attribute: string; before: any; after: any; }[]; recommended_action: "revert" | "accept" | "ignore"; } interface RemediationPlan { strategy: "manual" | "semi-automated" | "fully-automated"; steps: RemediationStep[]; estimated_duration: string; rollback_plan: string; } interface RemediationStep { action: "revert" | "accept" | "ignore"; resource: string; reason: string; severity: "high" | "medium" | "low"; method: string; // terraform apply, import, etc. approval: "required" | "auto"; }
Example output: See /skills/devops-drift-detector/examples/drift-detection-example.txt
yaml# Terraform drift detection with semi-automated remediation input: tool: terraform workspace: prod-webapp remediation_policy: semi-automated output: timestamp: "2025-10-25T21:30:36-04:00" tool: terraform scope: prod-webapp drift_detected: true drifted_resources: 2 resources: - id: aws_security_group.web type: aws_security_group change_type: modified severity: high changed_attributes: - attribute: ingress before: [{cidr: "10.0.0.0/8", port: 443}] after: [{cidr: "0.0.0.0/0", port: 22}] recommended_action: revert severity_summary: {high: 1, medium: 0, low: 1} remediation_plan: strategy: semi-automated steps: - action: revert resource: aws_security_group.web approval: required
Token budgets enforced:
Safety checks:
Auditability:
Determinism:
Terraform Drift Detection:
Pulumi Drift Detection:
AWS CloudFormation Drift:
driftctl:
Drift Management Best Practices:
Resource files:
/skills/devops-drift-detector/resources/drift-detection-config.yaml - Sample drift detection configuration/skills/devops-drift-detector/resources/remediation-workflow.yaml - Remediation workflow template/skills/devops-drift-detector/resources/compliance-mapping.json - Drift to compliance control mappingOther measured skills in the registry, with their headline benchmark lift.