From devops-skills
Detects and categorizes infrastructure drift between Terraform state and actual AWS resources. Identifies out-of-band changes, assesses severity, and presents resolution options.
How this skill is triggered — by the user, by Claude, or both
Slash command
/devops-skills:terraform-drift-detectionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Detect and categorize drift between Terraform-managed state and actual infrastructure. Drift indicates out-of-band changes that can cause problems during the next apply.
Detect and categorize drift between Terraform-managed state and actual infrastructure. Drift indicates out-of-band changes that can cause problems during the next apply.
Announce at start: "I'm using the terraform-drift-detection skill to check for infrastructure drift."
# Verify AWS credentials and account
aws sts get-caller-identity
# Confirm we're in the right directory/environment
pwd
ls -la *.tf 2>/dev/null | head -5
# Initialize if needed
terraform init
# Refresh state to detect drift
terraform plan -refresh-only -out=drift.out
# Convert to JSON for analysis
terraform show -json drift.out > drift.json
Parse drift.json and categorize changes:
| Category | Severity | Examples |
|---|---|---|
| Security Drift | CRITICAL | Security groups, IAM, encryption |
| Configuration Drift | HIGH | Instance settings, networking |
| Tag Drift | LOW | Tags modified outside Terraform |
| Metadata Drift | INFO | AWS-managed fields that change |
Task(drift-detector) → Categorize and assess drift impact
Agent should:
## Drift Detection Report
### Summary
- Total drifted resources: X
- Critical drift: Y
- High drift: Z
- Low/Info drift: W
### Critical Drift (Requires Immediate Attention)
| Resource | Attribute | State Value | Actual Value |
|----------|-----------|-------------|--------------|
| ... | ... | ... | ... |
### Potential Causes
- Manual console changes: [list if detected]
- AWS service updates: [list if detected]
- Unknown origin: [list if detected]
### Recommended Actions
1. [Action for each drifted resource]
Present user with options:
terraform apply -refresh-only to update state to match actualterraform apply to revert actual infrastructure to match codeNever auto-resolve drift. Always get user approval.
Store detected drift patterns:
Query memory before analysis:
Before presenting:
npx claudepluginhub joshuarweaver/cascade-code-devops-misc-1 --plugin lgbarn-devops-skillsDetects, audits, and remediates drift between declared infrastructure-as-code and actual deployed state. Use for Terraform plan diffs, Kubernetes kubectl diff, or AWS Config drift detection.
Detects infrastructure drift between actual cloud state and IaC definitions using terraform plan, cloudformation drift detection, or pulumi. Triggered by phrases like 'check for drift'.
Analyzes Terraform, CloudFormation, and Pulumi configurations for module structure, state management, drift prevention, and security posture.