<?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: Naufal</title>
    <description>The latest articles on DEV Community by Naufal (@naufal_1de4cc47e726835614).</description>
    <link>https://dev.to/naufal_1de4cc47e726835614</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4271597%2F0b8e8b06-a202-4771-b0d6-aa9c9845a2c8.png</url>
      <title>DEV Community: Naufal</title>
      <link>https://dev.to/naufal_1de4cc47e726835614</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/naufal_1de4cc47e726835614"/>
    <language>en</language>
    <item>
      <title>I built a 3,000-pair Terraform error-fix dataset — and every fix is machine-verified</title>
      <dc:creator>Naufal</dc:creator>
      <pubDate>Sun, 29 Nov 2026 02:27:41 +0000</pubDate>
      <link>https://dev.to/naufal_1de4cc47e726835614/i-built-a-3000-pair-terraform-error-fix-dataset-and-every-fix-is-machine-verified-47ij</link>
      <guid>https://dev.to/naufal_1de4cc47e726835614/i-built-a-3000-pair-terraform-error-fix-dataset-and-every-fix-is-machine-verified-47ij</guid>
      <description>&lt;h1&gt;
  
  
  I built a 3,000-pair Terraform error-fix dataset — and every fix is machine-verified
&lt;/h1&gt;

&lt;p&gt;AI coding assistants are decent at &lt;em&gt;writing&lt;/em&gt; Terraform. Ask one to debug a broken config and it falls apart: it guesses, it hallucinates functions, it "fixes" things that were never broken.&lt;/p&gt;

&lt;p&gt;I think part of the problem is the training data. Most code datasets teach models to generate code from scratch. Almost none teach them to go from a &lt;strong&gt;real error message&lt;/strong&gt; to a &lt;strong&gt;correct fix&lt;/strong&gt; — because that data barely exists in a clean, verified form.&lt;/p&gt;

&lt;p&gt;So I built it: &lt;strong&gt;3,000 Terraform error → fix pairs&lt;/strong&gt;, where every single fix was machine-verified by actually running &lt;code&gt;terraform validate&lt;/code&gt;. No scraped Stack Overflow answers, no paraphrased errors, no "probably works" fixes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a record looks like
&lt;/h2&gt;

&lt;p&gt;Each record has the real error output, the broken HCL, the fixed HCL, and a short explanation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"tf-0001"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"functions"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"terraform_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1.9"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"error_message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Error: Call to unknown function\n\n  on main.tf line 2, in output \"web\":\n   2:   value = frobnicate(\"hello\")\n\nThere is no function named \"frobnicate\"."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"broken_hcl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"output \"web\" {\n  value = frobnicate(\"hello\")\n}\n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"fixed_hcl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"output \"web\" {\n  value = upper(\"hello\")\n}\n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"explanation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"frobnicate is not a Terraform built-in function, so the call fails. Replacing it with a real function such as upper() fixes the expression."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"difficulty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"beginner"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That &lt;code&gt;error_message&lt;/code&gt; is not something I wrote — it's the actual stderr captured from &lt;code&gt;terraform validate&lt;/code&gt;. The broken snippet really fails, and the fixed snippet really passes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three real examples
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. The typo Terraform actually catches for you (reference / beginner)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Reference to undeclared input variable

  on main.tf line 5, in output "web":
   5:   value = var.environmente

An input variable with the name "environmente" has not been declared.
Did you mean "environment"?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fix: &lt;code&gt;var.environmente&lt;/code&gt; → &lt;code&gt;var.environment&lt;/code&gt;. One character. This is the kind of error a model should learn to spot instantly — and the kind it currently "fixes" by inventing a new variable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Type mismatch in a default value (variable / beginner)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="c1"&gt;# broken&lt;/span&gt;
&lt;span class="n"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"environment"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;
  &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"abc"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Invalid default value for variable
This default value is not compatible with the variable's type constraint:
a number is required.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fix: &lt;code&gt;default = 8080&lt;/code&gt;. The pattern generalizes: a wrong-typed default is one of the most common beginner errors, and the fix is always "make the value match the declared type."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The missing brace (syntax / beginner)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Unclosed configuration block

  on main.tf line 1, in variable "environment":
   1: variable "environment" {

There is no closing brace for this block before the end of the file.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fix: add the closing &lt;code&gt;}&lt;/code&gt;. Trivial for a human, and exactly the sort of thing a fine-tuned model should nail 100% of the time — if it has ever seen the pair.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it was made (the honest version)
&lt;/h2&gt;

&lt;p&gt;This dataset is &lt;strong&gt;100% synthetic&lt;/strong&gt;. Nothing was scraped from GitHub, Stack Overflow, or any forum. The process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A cloud infrastructure engineer (7+ years of Terraform) hand-authored ~176 error patterns across HCL syntax, references, variables, functions, types, logic, &lt;code&gt;count&lt;/code&gt;/&lt;code&gt;for_each&lt;/code&gt;/&lt;code&gt;dynamic&lt;/code&gt;, providers, state, locals, and outputs.&lt;/li&gt;
&lt;li&gt;Each pattern was instantiated with varied identifiers and values.&lt;/li&gt;
&lt;li&gt;Every broken snippet was executed with &lt;code&gt;terraform validate&lt;/code&gt; (v1.9.8, provider-free configs) and the &lt;strong&gt;real&lt;/strong&gt; error output was captured.&lt;/li&gt;
&lt;li&gt;Every fixed snippet was executed with &lt;code&gt;terraform validate&lt;/code&gt; and required to pass (exit 0). Any pattern that failed this was fixed or dropped — never silently skipped.&lt;/li&gt;
&lt;li&gt;Automated scans: 0 secrets/PII hits, 0 exact duplicates.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The QC numbers: &lt;strong&gt;3,000/3,000 fixed snippets pass validation, 3,000/3,000 broken snippets produce a real error, 0 cross-split leakage&lt;/strong&gt; (verified by hash).&lt;/p&gt;

&lt;h2&gt;
  
  
  What's inside
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;3,000 records&lt;/strong&gt; across 11 categories and 3 difficulty levels (1,200 beginner / 1,200 intermediate / 600 advanced)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Train/val/test splits&lt;/strong&gt; (2,400 / 300 / 300) with zero leakage between splits&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JSONL + Parquet&lt;/strong&gt; formats — loads in one line with pandas, DuckDB, or 🤗 datasets&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Datasheet + QC report&lt;/strong&gt; documenting exactly how the data was made, what's in it, and its limits
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"terraform-error-fix-pro-train.jsonl"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;value_counts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The limits, stated plainly
&lt;/h2&gt;

&lt;p&gt;I don't want anyone to buy this under a false impression, so here are the real limits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It's synthetic.&lt;/strong&gt; The errors are real &lt;code&gt;terraform validate&lt;/code&gt; output, but the configs were authored, not collected from production incidents. It teaches the &lt;em&gt;shape&lt;/em&gt; of errors and fixes, not war stories.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Category skew.&lt;/strong&gt; &lt;code&gt;functions&lt;/code&gt; is 38.7% of the data (1,160 of 3,000). That's because function misuse has the most distinct failure modes — but if you need a balanced category mix, you should know.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Provider-free configs.&lt;/strong&gt; The snippets validate without providers, so provider-specific errors (AWS/Azure resource arguments) are out of scope.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Terraform 1.9.8.&lt;/strong&gt; Error wording is version-specific; newer Terraform versions may phrase some errors differently.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it's for
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Supervised fine-tuning&lt;/strong&gt; of code assistants for Terraform troubleshooting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation benchmark&lt;/strong&gt; for error-diagnosis accuracy (the test split is a clean 300)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RAG / retrieval examples&lt;/strong&gt; for IaC help bots&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it free
&lt;/h2&gt;

&lt;p&gt;There's a &lt;strong&gt;free sample: 300 pairs&lt;/strong&gt; (same format, same verification, CC-BY-4.0) — enough to check whether the data fits your pipeline before spending anything:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Free Lite sample (300 pairs):&lt;/strong&gt; &lt;a href="https://kitforgelab.gumroad.com/l/cuppd" rel="noopener noreferrer"&gt;https://kitforgelab.gumroad.com/l/cuppd&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The full PRO dataset (3,000 pairs, JSONL + Parquet, splits, datasheet, commercial Team License) is $25:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;PRO dataset:&lt;/strong&gt; &lt;a href="https://kitforgelab.gumroad.com/l/terraform-error-fix-dataset-pro" rel="noopener noreferrer"&gt;https://kitforgelab.gumroad.com/l/terraform-error-fix-dataset-pro&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you fine-tune on it, I'd genuinely love to hear how it performs — especially on the test split. The whole point of verifying every fix mechanically was to make the benchmark trustworthy, and the only way to know if that paid off is people actually using it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built by KitForge. Questions: reply to your Gumroad receipt email, or find me on Threads &lt;a href="https://www.threads.net/@kitforgelab" rel="noopener noreferrer"&gt;@kitforgelab&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>terraform</category>
      <category>devops</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
