Terraform / OpenTofu AI Agent Directives
Plan security, state drift, module upgrades, OPA policy and cost estimates.
Terraform and OpenTofu are the language most teams use to describe infrastructure, which makes the code, the plan, and the state the perfect targets for an AI agent. These directives turn an agent into a reviewer that sits between the plan and the apply: scanning a terraform plan for security risks, detecting state drift against live infrastructure, planning module and provider upgrades with breaking-change analysis, validating plans against OPA policy, estimating cost, catching refactor mistakes that would destroy resources, and staging imports for brownfield estates. Each windsurf terraform or cursor rules terraform directive is written to run against the real CLI, from opentofu plan and terraform show to opa eval, and it always keeps the agent read-only unless a change is explicitly authorized. The central idea is that terraform drift and plan risks are reproducible analyses an agent can do reliably rather than mysteries to be feared. Teams collecting cursor rules terraform or opentofu directives get prompts that produce a diff table, a severity list, and a safe migration order instead of a vague summary. Save these for any branch that changes terraform, and the review writes itself against the plan. Put them in a rules file and re-run whenever a PR touches IaC, and the most fragile part of infrastructure change becomes the part an agent checks first and consistently.
Terraform Plan Security Review
Analyze a Terraform plan output for security risks: public S3 buckets, open security groups, plaintext secrets, and overly permissive IAM.
View directiveTerraform State Drift Detection
Compare Terraform state with real infrastructure to detect drift and unauthorized out-of-band changes.
View directiveTerraform Module Upgrade Assistant
Upgrade Terraform modules to the latest provider versions with breaking change analysis and migration steps.
View directiveTerraform Policy Check with OPA
Validate Terraform plans against Open Policy Agent rules for tagging, naming, and security compliance.
View directiveTerraform Cost Estimation
Estimate the monthly cost impact of a Terraform plan by analyzing resource changes and pricing data.
View directiveTerraform Refactor Detector
Detect when Terraform changes will cause resource recreation instead of in-place update, and suggest moved blocks.
View directiveTerraform Import Planner
Generate terraform import commands for existing cloud resources that are not yet managed by Terraform.
View directiveStop pasting. Start automating.
Every one of these Terraform / OpenTofu directives is something Devopsify can run continuously against your estate, with policy gates, approvals, and a retained audit trail instead of a manual run.