Generative AI is becoming a standard part of IaC workflows โ bringing speed, structure, and new risks.
Generative AI has officially entered the infrastructure as code (IaC) trenches. What started as a bottom-up phenomenon โ developers using ChatGPT and Copilot to avoid Googling Terraform syntax or getting bogged down in endless StackExchange threads โ has grown into something more complex and widespread. Today, organizations are embracing AI as a tool not just for writing configs, but for shaping infrastructure decisions, integrating with observability, and even catching deployment errors.ย ย
But the story isnโt just one of acceleration. As AI-generated IaC becomes more common as part of the AI data center, so do the pitfalls โ from silent misconfigurations to public-facing APIs no one meant to expose.ย
Rise of the machinesย
Letโs start with what you can probably guess: Developers have been using generative AI tools to write IaC config code for some time now. In many places, especially early on, this was a bottom-up movement driven individual developers. โA lot of developers I know, especially those who arenโt IaC experts, are leaning on ChatGPT or Copilot to generate Terraform or Ansible configs,โ says Siri Varma Vegiraju, Security Tech Lead at Microsoft. โItโs fast, and it helps people avoid looking up every AWS resource syntax or module.โย ย
That speed and accessibility come from the way AI has lowered the bar to writing configuration code. Ivan Novikov, CEO of Wallarm, puts it this way: โAI reduces the threshold for devs to write configs without deep knowledge. Before AI, writing production-ready Kubernetes or Terraform config was for SREs, DevOps, infra teams. Now, any backend dev can open ChatGPT and ask โmake me a Helm chart for my API with autoscaling and ingress.โ And AI will do it.โย
This democratization of IaC also means that a lot of experimentation happens without much oversight. โMany developers quietly use ChatGPT/Copilot to draft IaC templates, especially for unfamiliar cloud services,โ says Fergal Glynn, chief marketing officer and AI security advocate of Mindgard. โWhile this speeds up tasks, unreviewed AI code risks security gaps (e.g., overly permissive rules).โย
โIn many companies,โ Milankumar Rana says, software engineer advisor and senior cloud engineer at FedEx, โsuch usage began informally โ engineers โon the slyโ asking ChatGPT how to create a resource block or fix an obscure provider error. However, we are now observing a more structured approach to adoption.โย
That shift is being driven by larger organizations that see potential in AI-assisted IaC but want it embedded within guardrails. As Glynn puts it, โLarger orgs use AI-augmented platforms (e.g., Torqueโs Environment-as-Code) with guardrails to prevent errors. Startups and devops teams often experiment first, while enterprises prioritize governance frameworks.โย
When enterprises get on board with AIย
As the use of generative AI expands in infrastructure engineering, many organizations are responding by developing internal tools to guide and govern that usage. Nimisha Mehta, Senior DevOps Engineer at Confluent, notes that โAI-forward tech organizations adopt various tools such as IDEs with AI plugins, and even invest time and money into building bespoke systems and tools to integrate LLMs with their specific environments.โย
One increasingly common approach is to create internal AI โplaygrounds โโ sandbox environments that allow teams to test configurations without risking production infrastructure. โSandboxes allow developers to experiment with IaC templates, validate outputs to catch errors before deployment,โ says Mindgardโs Glynn. โBy balancing innovations with oversight, these playgrounds can minimize risks, such as security gaps, while encouraging controlled adoption of AI infrastructure-as-code workflows.โย
Sometimes, organizations are driven to develop such internal tools specifically in response to chaotic early AI-generated IaC efforts. Ori Yemini, CTO and co-founder of ControlMonkey, describes one such case: โA customer used ChatGPT to bulk-generate Terraform files for around 80 microservices. It worked, until they realized none of the generated code adhered to their tagging policies, module conventions, or team-based permissions. Their drift detection flagged hundreds of deltas against their baseline. The code โworkedโ technically, but operationally it created chaos.โย
The solution? A tailored internal tool that wrapped the LLM in organizational context. โThey shifted toward a controlled approach: using an internal wrapper around the LLM with prompts that inject organization-specific context, like required tags, naming conventions, and known module repositories. This drastically reduced both drift and rework,โ Yemini says.ย
Promises and pitfallsย of gen AI and IaC
At its best, generative AI acts as a powerful accelerant for infrastructure work. โWeโre seeing a quiet but significant shift in how engineering teams approach Infrastructure as Code,โ says ControlMonkeyโs Yemini. โItโs not just about writing a quick Terraform snippet anymore, itโs about accelerating infrastructure decisions in environments that are growing more complex by the day.โ FedExโs Rana echoes this, noting that โwhat used to take hours of cross-referencing documentation is now often accelerated by a single well-phrased cue.โ He points to common use cases like creating reusable Terraform modules, converting shell scripts into Ansible playbooks, and scaffolding TypeScript for Pulumi code.ย
The benefits go beyond code generation. AI is starting to integrate with observability systems to help manage infrastructure in real time. Microsoftโs Vegiraju notes, โMore advanced setups are experimenting with feeding telemetry into AI systems that can suggest or even automatically apply IaC-based fixes. For example, if a service is repeatedly scaling out due to CPU exhaustion, the AI might propose a config tweak to increase CPU limits or change autoscaling thresholds.โ While these are mostly proof-of-concept efforts in telemetry-heavy environments, they signal a direction where AI becomes more than just a code-writing assistant.ย
Confluentโs Mehta points to similar developments on the operational side, extolling the troubleshooting prowess of agentic AI. โSay you have a network packet that flows through several layers in the networking stack, she says. โAI is great at eliminating options to pinpoint the root cause of the issue.โ She sees this as a precursor to more autonomous, self-healing systems, though notes theyโre still in early stages.ย
But for all its promise, AI still lacks a basic quality that human engineers rely on: context. โAlthough AI is great at writing IaC and YAML manifests,โ Mehta says, โits biggest current shortfall is not having visibility on how distributed production-grade infrastructure is actually set up in the real world.โ Agentic tools are starting to address this by integrating more directly with infrastructure, but, she notes, โthey donโt scale to thousands of compute clusters.โย
Wallarmโs Novikov is even more blunt: โPrompts donโt carry full context about your infra and settings. Your infra is big. You have dozens of services, secrets, RBAC rules, sidecars, CI/CD flows, policies, naming rules, and many things in Terraform state. AI doesnโt know all that. When you ask โwrite config for API X,โ it works in a vacuum.โย
That vacuum can result in mistakes that are difficult to spot but potentially damaging. โAI-generated configs can be syntactically right but semantically wrong,โ says Microsoftโs Vegiraju. He offers a simple example of Terraform config code written by AI based on a simple prompt:ย
resource "azurerm_storage_account" "example" {
name = "examplestorageacct1"
public_network_access_enabled = true
}
That configuration will deploy successfully โ but also opens the storage account to the public internet. โWithout strict network rules or identity-based access controls, this could lead to unauthorized access or data exfiltration,โ he says. โIn over 90% of real-world scenarios, public network access should be disabled.โย
Security oversights like that are far from theoretical. โConfigs often miss security best practices,โ says Novikov. โNo rate limits, wide network exposure (0.0.0.0/0), missing resource limits, open CORS, and no auth on internal APIs.โ In one real-world case, a fintech developer used AI to generate ingress for an internal API. โThey forgot to add IP whitelisting. The API went public, got scanned in 20 minutes, and attackers found an old debug route.โย
A cautious look ahead at AI and infrastructureย
As generative AI becomes more embedded in infrastructure workflows, its role is evolving. โOne pattern weโre noticing across several mid-to-large scale orgs is this: AI is being used as a โfirst draft generator,โ but increasingly also as a decision-support tool,โ says ControlMonkeyโs Yemini. โEngineers arenโt just asking, โHow do I write this AWS security group?โ theyโre asking, โWhatโs the cleanest way to structure this VPC for future scale?โโ He notes that these questions arenโt confined to early design stages โt hey come up mid-sprint, when real-world blockers hit. โFrom our perspective, the most successful orgs treat generative AI like an untrained junior engineer: useful for accelerating tasks, but requiring validation, structure, and access to internal standards.โย
That need for human oversight was a recurring theme with everyone we spoke to. Microsoftโs Vegiraju puts it simply: โEngineers should first understand the code coming out of the LLM before using it.โ At Confluent, Mehta emphasizes the importance of safeguards: โWe need guardrails built into the system to prevent accidental breaking changes, be it due to human error or due to AI-generated changes.โ She points to GitOps systems and peer-reviewed version control as ways to build accountability into the workflow.ย
Mindgardโs Glynn sees a similar pattern emerging. โModels like WISDOM-ANSIBLE generate Ansible playbooks just by providing natural language prompts,โ he says, โbut AI-generated YAML/Chef files do require manual tweaks for edge cases.โ Enterprises may use these tools to enforce compliance โ for instance, automatically adding HIPAA settings โ but they still review outputs for accuracy before deployment.ย
Without that diligence, the risks can compound quickly. Wallarmโs Novikov recounts a troubling trend: โOne large SaaS org told us 30% of their IaC is now AI-generated. But they also see three times more config misfires in CI/CD than last yearโwrong secrets, open ports, wrong S3 policies, unprotected APIs.โ That company now uses tools like Checkov, tfsec, and custom Wallarm rules to catch misconfigurations after the fact. But the root cause is often speed outpacing safety. โOne junior dev told us: โI just paste the prompt, review the YAML looks ok, and push.โ Thatโs where issues sneak in.โย
The tools are getting better โ yet the need for caution is still there. โAI is so powerful,โ Novikov says. โBut when it comes to PaaS and APIs, itโs risky if used blindly. Without proper policy checks, context awareness, and testing, AI-generated configs become new security debt.โย
โYou use AI for infra?โ he says. โCool. Just donโt trust it too much.โย


