Asset 20 8 2
Does AI recommend your business? Run the free check →

Join 15,000 business owners, marketers and entrepreneurs. The Sunday newsletter you'll be annoyed only arrives once a week.

Article

AI Agents for Terraform: 10 Tools for Code, Plans and Drift

An MCP server that feeds your existing coding assistant current Terraform provider docs is where I'd start, because it fixes the stale-syntax problem without giving a model any power over your cloud. Add a request-to-code agent, a pull-request agent or a governed deployment platform only once you've decided whether the AI writes code, ships it, or watches what's already running.

You ask your assistant for a private storage bucket with versioning and logging. It hands back thirty tidy lines of HCL, and two of the arguments were renamed in a provider release the model never saw. That's the everyday failure with AI and Terraform, and it's why the first question isn't which agent is cleverest. It's what the agent is allowed to touch: your code, your plan, your apply, or your live estate.

The tools below split along that line. Some only write configuration. Some run deployments inside guardrails. Some watch for drift or roll things back. And they differ in where the work happens: in a pull request your team already reviews, or in a visual designer that draws the infrastructure first and writes the code second.

The kinds of Terraform AI agent, side by side

Here's what each type does and where I'd look hardest before letting it near production.

Type of toolWhat the AI doesFitsWatch for
MCP server for your assistantGives the assistant you already use current provider docs, modules and policiesAnyone already writing Terraform with an AI assistantIt informs the model; it doesn't review or deploy anything
Request-to-code agentTurns a plain request into Terraform or OpenTofu, ideally from your approved modulesPlatform teams fielding repeat infrastructure requestsWhether it uses your module catalogue or writes freehand
Pull-request agentPrepares changes and opens pull requests within a policy you setTeams that already review every change in GitWho can merge, and what the agent's cloud role can do
Governed deployment platformRuns plans and applies with guardrails, for people and for agentsTeams with many stacks, environments and approversHow approvals are enforced when the requester is an agent
Visual designer with AIDraws infrastructure from a description and generates the codePeople who think in diagrams before modulesHow cleanly the generated code fits your repo layout
Drift and recovery platformWatches running infrastructure and helps restore or roll backEstates where manual console changes creep inWhat it changes on its own and what waits for a person

Why stale training data is the first thing to fix

Terraform moves through providers, and providers change faster than models are retrained. An assistant that learnt a resource's arguments a while ago will write them confidently and wrongly. HashiCorp's own answer is the Terraform MCP server, which its page says gives AI models real-time access to current provider documentation, modules and policies from the registry.

I like this as a baseline because it changes what the model knows, not what it can do. HashiCorp describes the server as giving access to provider docs, modules and policies, and to HCP Terraform and Terraform Enterprise workspaces as well, so if you connect it to those, use a token with the narrowest scope that does the job. Before you trust any assistant, with or without a connector, pin your provider versions in a required_providers block, commit the .terraform.lock.hcl file, and run terraform validate on whatever it writes. If validate complains about an argument that doesn't exist, you've found the stale-data problem in your own repo.

Agents that write the Terraform

Terraform MCP server

HashiCorp's own MCP server, which hands any AI assistant current Terraform provider documentation, modules and policies from the registry instead of whatever the model remembers.

StackGen

Its Aiden for InfraOps agent turns an infrastructure request into Terraform or OpenTofu, then runs policy checks and waits for team approval before deployment.

Cloudgeni

Policy comes first here: agents for compliance, drift, cost and reviews prepare Terraform changes and open pull requests that stay inside it.

Brainboard

Describe what you need and this AI-driven visual designer draws the infrastructure, generates the Terraform code and manages Terraform and OpenTofu modules.

Platforms that plan, deploy and recover

Spacelift

A hosted infrastructure-as-code orchestration platform with its own AI assistant and MCP server, documented for Terraform and OpenTofu.

env zero

Built as a cloud control plane, it lets developers and AI agents deploy infrastructure inside guardrails, with Terraform workflows supported.

Terramate

An automation layer over Terraform, OpenTofu and Terragrunt stacks, so developers and AI agents can self-serve infrastructure across environments.

Stategraph

Open-source orchestration with a hosted side that plans Terraform or OpenTofu on every pull request and lists AI agents among its uses.

Firefly

A hosted cloud resilience platform that wraps AI agents and guardrails around Terraform deployments.

ControlMonkey

Recovery is the job: a hosted platform for infrastructure as code, with an AI agent rollback feature aimed at Terraform-run estates.

Writing code and running it are separate decisions

It's tempting to buy one agent that does everything. I'd split the decision in two. Letting a model write HCL is low risk if a human reads the plan. Letting a model apply is a different conversation, because now it's holding a cloud credential.

Request-to-code agents are at their safest when they build from modules your platform team already approved, rather than inventing resources from scratch. StackGen describes its agent that way: standard Terraform or OpenTofu from your approved module catalogue, with policy checks and team approval before deployment. Whatever you shortlist, get a generated change in front of you and check whether it calls your modules or writes raw resources. Raw resources are where your naming, tagging and network rules quietly go missing.

Work with me

Want AI doing the heavy lifting in your marketing?

I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.

For the apply side, governed deployment platforms put a policy layer and an approval step between the request and the cloud. The question to test is what happens when the requester is an agent rather than a person. Ask to see an agent-raised change go through the same approval path a human's would, and check whose identity shows in the audit trail. If you're weighing these platforms against plain orchestration without the AI, the wider comparison of infrastructure as code tools sets out the non-AI options.

Keep the pull request as the checkpoint

If your team already reviews every change in Git, the cleanest place for an agent is the same pull request a person would open. The agent proposes, the plan is posted against the change, a human merges. Nothing reaches the cloud that nobody read.

Read the plan the agent produces the way you'd read a junior engineer's. Terraform's summary line tells you how many resources it'll add, change and destroy; anything marked must be replaced means a delete followed by a create, which on a database or load balancer is an outage you didn't ask for. If an agent's pull requests regularly carry replacements you didn't expect, it's not ready for your estate, however fluent its descriptions are.

Check the credentials too. A pull-request agent only needs to plan, so test whether the role it runs under can apply. If it can, narrow it before go-live, not after.

Drift, rollback and the live estate

The third fork is AI that looks at what's running rather than what's written. Someone changes a security group in the console at midnight, and your code no longer describes reality. Terraform can already show you this: terraform plan -refresh-only reports changes made outside Terraform without proposing to undo them.

Drift and recovery platforms build on that idea with agents that watch continuously and help restore a known-good state. The test I'd run is simple. In a sandbox account, change a resource by hand, then see what the tool reports, what it proposes, and whether it acts before a person agrees. Then try a rollback of a change you made through Terraform and check that the code and the live estate agree afterwards. A rollback that fixes the cloud but leaves your repo describing the old state just creates the next drift.

An hour with your own repo

Demos use clean examples. Your repo won't be clean, so test there, against a sandbox account.

Pick a small module you know well. Ask each shortlisted agent for one realistic change, such as adding encryption to a bucket or a new subnet. Run terraform validate, then terraform plan -out=test.plan and terraform show -json test.plan to see exactly what would change. Note three things: did it use your existing modules and variables, did the plan touch anything you didn't ask about, and did it respect your pinned provider versions.

Then ask for something it should refuse or flag, such as opening a port to the whole internet. An agent with real policy checks will stop or warn. One without them will write it cheerfully. That single request tells you more than any feature list.

Do you make AI agents or AI tools for Terraform? Tool makers can ask to be considered for a featured place on this list.

OpenTofu, cost and what to check on the pricing page

If you've moved to OpenTofu or might, don't assume coverage from a logo on a home page. Check each tool's documentation names it for the workflow you need, not just for import. If you're still deciding between the two, the guide to Terraform alternatives covers the move itself.

On cost, none of the vendor pages behind this list published a price for the AI features, so I can't give you a range. Go to each pricing page and check whether the AI agent is included or sold separately, whether there's a free plan or trial, and what the bill is counted against. Ask before you commit rather than after the first invoice.

Where I'd start, situation to situation

Writing Terraform yourself with an assistant: add an MCP server for current provider docs and keep doing your own plans and applies. Fielding the same infrastructure requests over and over: a request-to-code agent that builds from your approved modules, with approval before deployment. Reviewing everything in Git already: a pull-request agent whose role can plan but not apply. Running many stacks and environments: a governed deployment platform that treats agent requests exactly like human ones. Fighting console changes and messy incidents: a drift and recovery platform, tested in a sandbox first.

For AI across the rest of the pipeline, beyond infrastructure code, there's a broader list of AI tools for DevOps. Whatever you pick, let the plan be the thing a human always reads.

Want your tool on this list? Featured spots and reviews here are paid partnerships. Here's how to partner with me.

Published and maintained by the Lilach Bullock team, covering marketing, AI and business growth.
Your buyers are asking AI who to use. Does it say you?

See for free whether ChatGPT, Claude, Perplexity, Gemini and Google name you, and get the plan to become the answer.

Check my AI visibility →
Sundays only

Get the Sunday newsletter.

One email a week. AI experiments, marketing tactics, and the workflows Lilach is building right now in her own business.

Subscribe free

Let’s get your marketing running on AI.

Book a free 30-minute call

We figure out what you need, where AI fits in, and what working together would look like.

Book the call →

Or take the 30-second calculator

You’ll see the hours and the money quietly leaking out of your week, and the three workflows worth building first.

Take the calculator →

Or grab the free AI resource library

Prompt packs, templates, checklists, and swipe files. The exact tools I build for paying clients. Yours, free.

Get the library →
Keep reading

More from the blog.