I Built an AI That Fixes Terraform Drift Automatically
I Built an AI That Fixes Terraform Drift Automatically If you've worked with Terraform long enough, you know the feeling. You run terraform plan and suddenly there are 12 unexpected changes. Someone tweaked an instance type in the console. A security group rule got added manually. A tag got removed. Your infrastructure drifted — and now you have to figure out what changed, why, and how to bring…
An engineer has developed an AI-powered tool called tfdrift remediate to automatically fix drift in Terraform configurations. Drift occurs when manual changes to infrastructure result in unexpected differences between the desired state defined in Terraform code and the actual state in the cloud. The tool detects drift across all Terraform workspaces, classifies the severity of each change, and then uses large language models like Claude or GPT-4o to generate a remediation file with corrected Terraform definitions.
By reviewing the AI-generated file, engineers can verify the fixes and then apply them via Terraform. This saves hours of manual work when fixing many resources across multiple environments. The tool works with both Terraform and OpenTofu, supports multiple AI providers, and can fix drift with a single command. While it's not a replacement for terraform apply, it provides a safer way to apply AI-driven corrections to production infrastructure by requiring human review first.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.