What went wrong when an AI agent rewrote our Terraform?
A founder at a twenty-person startup told me this story last month. His team asked a coding agent to refactor their Terraform. The agent produced clean files. Variables looked right. Resource names matched. They ran terraform plan. The plan showed no changes. They merged the PR. That night, their production database vanished.
A founder at a twenty-person startup told me this story last month. His team asked a coding agent to refactor their Terraform. The agent produced clean files. Variables looked right. Resource names matched. They ran terraform plan. The plan showed no changes. They merged the PR. That night, their production database vanished.
The agent had renamed a resource block. Terraform saw a new resource. It destroyed the old one and created a new one. The plan looked safe because the agent also deleted the lifecycle prevent_destroy block. The team did not catch it. They trusted the tool.
This is not a bug in the agent. This is a gap in ownership. The agent wrote code. No one owned the blast radius. No one asked what happens if this is wrong. No one compared the new state file against the old one.
At roqy.io we see this pattern weekly. A startup tries coding agents DevOps work. They move fast for three weeks. Then something breaks at the worst moment. The fix always costs more than the speed saved. One hour of saved typing turns into six hours of incident response, one day of customer communication, and one week of trust repair.
Can coding agents handle production infrastructure?
Coding agents can write Terraform, Dockerfiles, CI/CD pipelines, and shell scripts. They can explain Kubernetes errors. They can suggest IAM policies. They are fast. They do not sleep. They can read hundreds of pages of documentation in seconds. They cannot handle production infrastructure. Handling production means more than writing code.
Coding agents can write Terraform, Dockerfiles, CI/CD pipelines, and shell scripts. They can explain Kubernetes errors. They can suggest IAM policies. They are fast. They do not sleep. They can read hundreds of pages of documentation in seconds.
They cannot handle production infrastructure. Handling production means more than writing code. It means knowing what happens when that code fails. It means understanding which customers are affected, which compliance rules apply, and which rollback path is safe.
A coding agent does not get paged. It does not sit on a call with AWS support. It does not explain to the board why revenue stopped for two hours. It does not choose between a fast fix and a correct fix under pressure. It does not apologize to a customer.
So can AI replace DevOps? Not today. Not even close. DevOps is not a coding job. It is a system ownership job. The code is the easy part. The hard part is knowing what the code does to a living system.
Why does AI generated Terraform fail in real systems?
AI generated Terraform fails for three reasons. First, agents guess context. They do not know your last incident. They do not know that your RDS instance has a manual snapshot dependency. They do not know your finance team forbids certain instance types.
AI generated Terraform fails for three reasons.
First, agents guess context. They do not know your last incident. They do not know that your RDS instance has a manual snapshot dependency. They do not know your finance team forbids certain instance types. They do not know that one microservice is deprecated but still serves one enterprise customer. They predict the next token based on patterns. Your system is not a pattern. It is a specific history.
Second, agents optimize for looking correct. A plan that says no changes looks safe. A resource rename that deletes data looks like a refactor. The agent has no skin in the game. It does not feel the consequence. It does not watch the metrics drop. It does not read the angry Slack messages.
Third, agents do not maintain state over time. A human DevOps engineer remembers why you picked us-east-1 instead of eu-west-1. They remember the failed migration from six months ago. They know which services are actually used and which ones are just still running because no one dared to delete them.
These AI infrastructure mistakes are predictable. They happen when speed replaces ownership. They happen when a team treats a confident machine like a careful engineer.
What parts of DevOps can AI actually do today?
AI is useful in DevOps. I use it daily. It writes boilerplate. It turns a vague error message into a search query. It drafts runbooks. It speeds up the boring parts. It helps me remember syntax I do not use often.
AI is useful in DevOps. I use it daily. It writes boilerplate. It turns a vague error message into a search query. It drafts runbooks. It speeds up the boring parts. It helps me remember syntax I do not use often.
Good use cases include writing initial Terraform modules, generating CI/CD templates, explaining cloud provider errors, creating monitoring dashboards, and summarizing logs. It can suggest why a pod is crashlooping. It can rewrite a Dockerfile to use a smaller base image. It can produce a first draft of an incident postmortem.
The value is acceleration, not replacement. A senior engineer with an agent moves faster than a senior engineer alone. A junior engineer with an agent produces better first drafts. But the engineer still reviews, tests, and owns the outcome.
Coding agents DevOps work best as a pair programmer, not as a team member with deploy rights. Give it a keyboard. Do not give it the keys.
What parts of DevOps still need a human owner?
Production architecture needs a human. Security boundaries need a human. Incident response needs a human. Vendor negotiation needs a human. Cost decisions need a human. Compliance needs a human. On-call rotation needs a human. When an outage happens, someone has to decide whether to roll back, scale up, or fail over.
Production architecture needs a human. Security boundaries need a human. Incident response needs a human. Vendor negotiation needs a human. Cost decisions need a human. Compliance needs a human. On-call rotation needs a human.
When an outage happens, someone has to decide whether to roll back, scale up, or fail over. That decision carries business risk. Coding agents do not understand business risk. They understand probability distributions. They cannot weigh a ninety percent chance of a fast recovery against a ten percent chance of data loss and choose based on company values.
When you choose between saving five thousand dollars a month and adding one minute of latency, that is not a technical question. It is a product question. The person who owns the system answers it.
When a regulator asks why you store data in a specific region, the agent cannot talk to the auditor. The human owner can. When a customer asks for a SOC 2 report, the agent cannot sign it. The human owner does.
This is the roqy.io differentiating opinion. AI can write code. It cannot own the system. Ownership is what makes DevOps work.
Should startups use coding agents for DevOps at all?
Yes. But with rules. Use coding agents for first drafts. Use them for repetitive config. Use them to learn a new provider. Use them to generate examples for a technology your team has not used before. Do not use them to refactor production state. Do not use them to rotate credentials.
Yes. But with rules.
Use coding agents for first drafts. Use them for repetitive config. Use them to learn a new provider. Use them to generate examples for a technology your team has not used before. Do not use them to refactor production state. Do not use them to rotate credentials. Do not let them push directly to main. Do not let them approve their own pull requests.
Start with low-stakes environments. Staging only. Review every change like it came from a new contractor. Run full tests. Keep an incident runbook written by a human. Define who gets paged when the agent's change breaks something.
The startups that get hurt are the ones that skip the review step. They confuse fast output with correct output. They treat the agent like a senior engineer. It is not. It is a tool that writes fast and makes confident mistakes.
The startups that win use agents to remove toil. They keep humans for judgment. They build a DevOps culture first, then add AI on top. That order matters. A fast tool in a careless team is a liability. A fast tool in a careful team is a multiplier.