<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: !null</title>
    <description>The latest articles on DEV Community by !null (@not_null).</description>
    <link>https://dev.to/not_null</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3829981%2Fe035cabd-2e78-4fe7-a884-1a01eedde651.png</url>
      <title>DEV Community: !null</title>
      <link>https://dev.to/not_null</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/not_null"/>
    <language>en</language>
    <item>
      <title>How I Built an Offline Mock Cloud to Train a Deterministic Terraform AI</title>
      <dc:creator>!null</dc:creator>
      <pubDate>Tue, 17 Mar 2026 19:50:16 +0000</pubDate>
      <link>https://dev.to/not_null/how-i-built-an-offline-mock-cloud-to-train-a-deterministic-terraform-ai-318l</link>
      <guid>https://dev.to/not_null/how-i-built-an-offline-mock-cloud-to-train-a-deterministic-terraform-ai-318l</guid>
      <description>&lt;p&gt;Generic AI models are terrible at writing enterprise Terraform.&lt;/p&gt;

&lt;p&gt;If you ask GPT-4o or Claude 3.5 to spin up an EC2 instance, they’ll do fine. But if you ask them to build a cross-region Transit Gateway, attach three VPCs, enforce strict least-privilege IAM, and attach a WAFv2 to a CloudFront distribution—they will hallucinate. They will invent arguments that don't exist in the provider schema, create circular dependencies, or miss critical cross-module references.&lt;/p&gt;

&lt;p&gt;Why? Because Large Language Models are probabilistic. They guess what the code should look like. But Infrastructure-as-Code (IaC) is a strict, mathematical dependency graph. It either compiles, or the data center burns down.&lt;/p&gt;

&lt;p&gt;At KHALM Labs, we realized you cannot train a cloud architect on probability. You have to train it on absolute, deterministic proof.&lt;/p&gt;

&lt;p&gt;The Data Wall and the AWS Rate Limit Trap&lt;br&gt;
To train a specialized, autonomous AI (AegisNode), we needed tens of thousands of perfect, highly complex Terraform architectures. The only way to guarantee a configuration is perfect is to run terraform plan.&lt;/p&gt;

&lt;p&gt;But if you try to programmatically run terraform plan on 20,000 AI-generated architectures against real AWS infrastructure, you hit a brick wall: AWS will instantly throttle your &lt;code&gt;sts:GetCallerIdentity&lt;/code&gt; calls, throwing 403s and 429s, and crashing your pipeline.&lt;/p&gt;

&lt;p&gt;The KHALM Offline Validation Engine (The Forge)&lt;br&gt;
We built a proprietary data factory to bypass this. Instead of hitting real AWS endpoints, our pipeline dynamically boots an air-gapped &lt;code&gt;moto_server&lt;/code&gt; mock cloud. We intercept the HashiCorp compiler and route all traffic locally.&lt;/p&gt;

&lt;p&gt;A massive 32B Teacher Model generates the initial Terraform.&lt;/p&gt;

&lt;p&gt;Our Python worker runs terraform &lt;code&gt;init&lt;/code&gt; and &lt;code&gt;terraform plan&lt;/code&gt; against the local mock.&lt;/p&gt;

&lt;p&gt;The Crucible: If the compiler finds a logical flaw, we capture the exact stderr AST logs, feed them back into the AI, and force it to rewrite the code.&lt;/p&gt;

&lt;p&gt;On "Hard Mode" enterprise architectures, the Teacher model requires an average of 3.1 iterations per prompt to pass the compiler. Think about that: the first guess is almost always logically broken. It takes our pipeline three full compiler-driven rewrites to produce a flawless dependency graph.&lt;/p&gt;

&lt;p&gt;When it finally passes &lt;code&gt;terraform plan&lt;/code&gt; with an exit code of 0, we save it. We call this a Gold Trajectory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get the Data&lt;/strong&gt;&lt;br&gt;
We believe in "Show, Don't Tell." Today, we are releasing a free sample of 500 Gold Trajectories from the KHALM Labs Forge. Every row in this dataset has been mathematically proven by an offline compiler.&lt;/p&gt;

&lt;p&gt;If you are an AI researcher or a DevOps engineer, you can use this data right now for Supervised Fine-Tuning (SFT) or Agentic DevOps benchmarking.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://huggingface.co/KHALM-Labs" rel="noopener noreferrer"&gt;https://huggingface.co/KHALM-Labs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The era of hoping your AI generated valid infrastructure is over. We don't trust the AI. We trust the compiler.&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>machinelearning</category>
      <category>ai</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
