AI agents are getting incredibly good at writing Infrastructure as Code (IaC). But there is a massive difference between generating valid HCL and actually executing it against production state.
Recently, the DevOps community saw a worst-case scenario: an unconstrained AI agent ran terraform destroy against the wrong state file, obliterating real infrastructure. It proved a hard truth—AI lowers the barrier to entry for Terraform, but when execution is unconstrained, it drastically increases the deployment risk.
At Deen-Labs, we wanted the speed of AI-driven infrastructure without the existential dread of a hallucinated S3 bucket wiping out production.
So, we built ShadowPlane—an open-source, Agentic CI/CD Gatekeeper that intercepts, tests, and heals AI-generated Terraform before it can merge.
The Problem: Unconstrained Execution
AI is fantastic at scaffolding modules and debugging issues. However, traditional CI/CD pipelines weren't built for non-deterministic code. If an AI hallucinates a fatal error (like an uppercase S3 bucket name) and pushes it to your main branch, it breaks the build. If it has write access to your state file, it breaks production.
The Architecture: A Deterministic Sandbox
ShadowPlane is packaged as a lightweight, Dockerized CLI tool that runs headlessly inside your pipeline (like GitHub Actions). It acts as a strict "Shift-Left" gatekeeper.
Here is how the event-driven workflow operates:
The Interception: When a developer (or an AI) opens a Pull Request with new Terraform code, ShadowPlane is triggered natively in the pipeline.
The Sandbox: It spins up a LocalStack Docker container right inside the CI runner, isolating the execution from your real AWS account.
The Self-Healing Loop: If terraform apply fails in the sandbox, ShadowPlane doesn't just crash. Our FastMCP-bridged AI agent analyzes the standard error, identifies the fault, patches the .tf file, and retries the deployment.
The Gatekeeper Exit Codes: If the infrastructure passes or is successfully healed, the CLI returns a strict sys.exit(0), turning the pipeline Green. If the blast radius cannot be safely contained, it returns sys.exit(1), turning the pipeline Red and physically blocking the merge.
We designed ShadowPlane to be instantly adoptable. You don't need to configure webhooks or maintain local servers. You just drop a single YAML file into your repository:
YAML
name: ShadowPlane Interceptor
on: [push, pull_request]
jobs:
shadowplane-gatekeeper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShadowPlane Agentic Substrate
uses: deenlabs/shadowplane-action@v1
with:
target_dir: './demo-infra'
max_retries: 5
Why We Open-Sourced It
AI will eventually become the primary interface for cloud operations. But until we have robust, sandbox-driven gatekeepers, letting agents run terraform apply is playing Russian roulette with your state file.
We built ShadowPlane to bring the predictability of standard cloud provisioning to AI-driven workflows.
You can check out the source code, the gatekeeper logic, and the LocalStack integration on our GitHub: https://github.com/GOLDSTEALTH/ShadowPlane
Tear it apart, test it, and let me know what you think in the comments.
Top comments (0)