DEV Community

Sourabh Yogi
Sourabh Yogi

Posted on

Stop Letting AI Agents Run terraform apply Unsupervised — Here's the Guardrail I Built

Been playing around with AI coding agents (Claude Code) writing and running Terraform lately, and honestly it freaked me out a little.

It can write the infra code, that's cool. But it can also just... run it. Straight to prod. No one looks at it first unless you build that in yourself.

So I spent a few days building something for myself — a small tool that sits between the AI and the actual terraform apply command, and just refuses to let it through without a real approval from me.

Tested it for real — created and destroyed real AWS resources, only after clicking Approve in Slack myself.

Made it open source in case anyone else is dealing with the same "ok but how much do I actually trust this thing" feeling:

Repo link: https://github.com/SORABH13/tf-approval-gate

One command to try it: npx tf-approval-gate

Top comments (0)