- Home
- Skills
- DevOps & Cloud
- Terraform Drift Detector Agent
Works with the AI Agents you already use
Terraform Drift Detector Agent
Analyze Terraform plan outputs to detect infrastructure drift and generate HCL import blocks for state reconciliation.
$15
Terraform Drift Detector Agent
Example session with this skill installed
Analyze this plan output. It shows an unexpected replacement for my RDS instance and several S3 buckets. Tell me why and give me the import blocks to fix it. [plan text attached]
- Read your context and instructions
- Compiled the terraform drift detector
I have analyzed the Terraform plan output. The RDS instance replacement is triggered by an out-of-band modification to the `allocated_storage` attribute, while the S3 buckets show drift in their `tags` configuration. ## Terraform Drift Analysis | Resource Address | Change Type | Root Cause | Remediation Action | | :--- | :--- | :--- | :--- | | `aws_db_instance.primary` | `+/-` replacement | `allocated_storage` changed from 20 to 100 externally. | Use `import` block or update HCL. | | `aws_s3_bucket.assets` | `~` update | `Environment` tag modified in AWS Console. | Add `ignore_changes` or sync tags. | | `aws_security_group.web` | `+/-` replacement | `name_prefix` collision detected. | Manual state rm and import. | ### Remediation Code ```hcl # Import block to sync the RDS instance state import { to = aws_db_instance.primary id = "db-prod-01" } # Lifecycle ignore for S3 tag drift resource "aws_s3_bucket" "assets" { # ... existing configuration ... lifecycle { ignore_changes = [ tags["Environment"], tags["ManagedBy"] ] } } ``` **Next steps** 1. Verify the `db-prod-01` identifier matches your actual RDS instance ID. 2. Run `terraform plan` again after applying these HCL changes to confirm zero-drift. 3. Review CloudTrail logs to identify who modified the RDS storage size manually.
Connects securely to your tools. The creator never sees your data.
About this skill
Manually reconciling Terraform state drifts is a tedious, error-prone process that stalls CI/CD pipelines. This skill automates the analysis of plan outputs to identify exactly why your cloud infrastructure has diverged from your HCL files. ## What it does - **Plan parsing** extracts meaning from verbose `terraform plan` text files to find discrepancies. - **Drift isolation** targets resources undergoing unexpected replacements or modifications. - **Root-cause analysis** identifies specific attribute mutations like tag changes or security group overrides. - **Code generation** produces ready-to-use `import` blocks and `ignore_changes` lifecycle clauses. - **Idempotency restoration** provides the logic needed to bring local state back in sync with actual cloud assets. ## How it works 1. **Input ingestion** involves providing the raw text output from a recent `terraform plan` execution. 2. **Resource mapping** compares the plan's proposed actions against your existing HCL declarations. 3. **Discrepancy reporting** highlights out-of-band changes made via cloud consoles or external tools. 4. **Remediation generation** outputs the HCL snippets required to fix the state mismatch. ## Frameworks & tools This skill is built for Terraform and OpenTofu workflows. It operates on HCL (HashiCorp Configuration Language) and standard CLI plan outputs. ## Why this beats prompting it yourself Generic prompts often struggle with the complex diff syntax of large Terraform plans, missing subtle nested attribute changes. This skill uses a deterministic workflow specifically tuned to isolate "forced replacement" triggers that cause accidental resource destruction. ## Use cases - Detect security group rules added manually via the AWS or Azure console. - Generate import blocks for resources created outside of the IaC workflow. - Resolve "plan always shows changes" loops by identifying mutating metadata. - Audit infrastructure for unauthorized configuration drift between deployments. ## Known limitations Does not execute `terraform apply` or perform live cloud API calls. Analysis is limited to the text provided in the plan output and local workspace files.
Cannot execute terraform apply or delete cloud assets. Restricted to static analysis of plan outputs and local HCL files. No live cloud provider authentication.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 4 days ago
Requires
Permissions
Target Use Cases: - Analyze terraform plan to find why my resource is being destroyed. - Detect configuration drift in this Terraform output. - Generate Terraform import blocks for unmanaged cloud resources.