AI Writes Your Terraform. That's the Problem.

Nondeterminism, stacked on drift, approved by people who didn't read it

AI Writes Your Terraform. That's the Problem.
James

The 2025 Stack Overflow survey contains a contradiction sharp enough to cut yourself on: 84% of developers use or plan to use AI tools, while 46% actively distrust their accuracy and only 3% highly trust them, with the most experienced developers reporting the deepest skepticism. An entire industry adopted a tool it does not trust. That's a manageable paradox when the tool writes application code, because compilers, type checkers, and test suites stand between a hallucination and production.

Now aim the same tool at infrastructure, where none of those guardrails exist, and you have this post. The claim: LLM-assisted infrastructure-as-code doesn't remove the complexity this blog has spent months cataloging; it mass-produces it, stacking a nondeterministic generator on top of an already drifting text-based substrate, and the fix is the same one it's always been. Infrastructure needs a deterministic model underneath the generation, not a larger model doing the generating.

What the autocomplete actually accelerates

Be precise about what AI changes in the IaC workflow: it collapses the cost of writing configuration while leaving the cost of understanding it untouched. That asymmetry has consequences. Repos that took years to grow now grow in weeks; variants multiply because generating a near-duplicate is cheaper than parameterizing; the marginal YAML that a tired human would have declined to write gets written, instantly, plausibly, in bulk. Complexity used to be rationed by human patience. The ration ended.

And the plausibility is the trap. Generated HCL looks like the real thing because looking like the real thing is precisely what a language model optimizes, so hallucinated attributes and confidently wrong resource arguments sail through linters that check syntax, through reviewers who check vibes, and fail twenty minutes into an apply, which we've established is the most expensive possible place to learn anything. Application code that lies gets caught by the test suite. Infrastructure code that lies gets caught by production, and the interval between merge and discovery is where incidents are born.

Nondeterminism, meet drift

The deeper problem is what the generator does to an already broken chain of custody. The text-file regime had three sources of truth that could disagree, files, state, and cloud, and drift was the name of their disagreement. AI adds a fourth layer with a property none of the others had: the same prompt, tomorrow, produces different code. The pipeline from intent to running infrastructure now passes through a probabilistic stage, which means provenance dies quietly. Six months from now, nobody on the team will know why that security group rule exists, and the honest answer, "the model wrote it and the diff looked fine", is an answer no auditor, regulator, or incident review has ever accepted from a human and shouldn't accept from a tool.

Put the survey numbers back on the table, because operationally they describe a specific behavior: distrust plus approval. Forty-six percent doubt the output; nearly everyone ships it anyway; review becomes a ritual performed on text nobody wrote and nobody fully reads, at a volume no reviewer can hold. We named this pattern before AI arrived, review theater on diffs of characters. AI didn't create it. It industrialized it.

The fix is a model, not a bigger model

Here's the reframe the tooling industry keeps missing while it fine-tunes: generation was never the bottleneck, verification was, and verification is exactly the job a deterministic system does better than any human or any LLM. If the source of truth is a graph with identity, dependencies, and invariants, the machine can answer "is this change valid, what does it touch, what breaks", before anything applies, every time, the same way. Put that underneath the generator and the division of labor snaps into place: the AI is genuinely excellent at intent, turning "give the API read access to the uploads bucket" into a proposed change, and the model is the thing that refuses the proposal when it violates an invariant, prices its blast radius when it doesn't, and records provenance either way.

That's the difference between autocomplete and an IDE, the distinction this blog opened with: an IDE doesn't guess-generate a rename and hope, it computes one against a semantic model, which is why nobody reviews a rename refactor character by character. Constrained generation against a deterministic substrate is the infrastructure version of that, it's what we're building ICE around, and yes, that makes this post our book as usual. The argument stands without us: a probabilistic writer needs a deterministic reader, and today's IaC stack has neither.

The steelman: we survived this panic before

The optimist's case is real and half right. Every generation of code automation triggered the same essay, compilers would hide the machine, Copilot would flood apps with bugs, and each time the tooling caught up and the productivity was kept. AI review of AI code is already decent and improving; models gain grounding and tool-use monthly; and the measured gains are genuine, teams really do ship infrastructure faster with assistance than without. Betting against model improvement has been a losing trade for years.

Concede the trajectory and keep the asymmetry, because it's the part trajectory doesn't fix. Application code earned its automation safely because deterministic backstops already existed to catch the generator's lies; the compiler panic was survivable since the compiler itself was the verifier. IaC has no equivalent, its errors are stateful, expensive, and discovered in production, and adding a second LLM as reviewer stacks another probabilistic layer where the missing piece is a deterministic one. The panic isn't that AI writes infrastructure. It's that nothing checks it that isn't also guessing. Build the checker and the generator becomes wonderful; that order, not the reverse.

So audit your own pipeline this week, one question, five minutes: when AI-generated infrastructure code merges, what stands between the hallucination and your production account, a system that knows, or a person who skimmed? If the answer is the person, the survey already told you how that story goes: 84% adoption, 46% distrust, and everyone approving anyway.

More articles