Coding
devops ai
iac ai
kubernetes ai

Infrastructure Automation

AI-driven Terraform, Ansible, Kubernetes manifest generation. Specialized + tool-use heavy.

Setup walkthrough

  1. Install Ollamaollama pull qwen2.5-coder:14b (~9 GB — strong at IaC languages: Terraform, Ansible, Kubernetes YAML).
  2. For Terraform generation:
ollama run qwen2.5-coder:14b "Generate a Terraform configuration for an AWS EKS cluster with 2 t3.medium worker nodes in us-east-1, VPC with public+private subnets, and an ALB ingress controller."
  1. First Terraform config in 10-30 seconds. Review and validate with terraform validate before applying.
  2. For Kubernetes manifest generation: prompt for a Deployment + Service + Ingress for a Node.js app.
  3. For Ansible playbook generation: prompt for a playbook that sets up Docker + NVIDIA Container Toolkit on Ubuntu 22.04.
  4. For CI/CD pipeline generation: prompt for a GitHub Actions workflow that builds, tests, and deploys to EKS.
  5. The model generates IaC code — always validate (terraform validate, kubectl --dry-run, ansible-playbook --check) before deploying. Models hallucinate resource names and IAM policies.

The cheap setup

Infrastructure automation is text-generation only. Qwen 2.5 Coder 7B runs on CPU on any $300 laptop at 20-40 tok/s. For Teams using Terraform/Kubernetes daily: a used GTX 1060 6 GB (~$60) runs 14B models at 40-60 tok/s — near-instant manifest generation. The compute is trivial. The value is in the quality of the generated IaC, not the speed of generation. $400 total (laptop + GPU) handles all local IaC AI needs. Infrastructure automation with AI is accessible to anyone who can run a 7B model — which is anyone with a laptop from 2020+.

The serious setup

Used RTX 3060 12 GB (~$200-250, see /hardware/rtx-3060-12gb) handles Qwen 2.5 Coder 32B at 35-50 tok/s — the 32B model generates production-quality Terraform modules with proper variable structures, outputs, and provider versioning. For DevOps teams managing complex multi-cloud infrastructure: the 32B model reduces IaC boilerplate by 70-80%. Total workstation: ~$900-1,200. Infrastructure automation AI doesn't need "serious" GPU — the models that generate the best IaC (Qwen Coder 32B, DeepSeek Coder V3) run on consumer GPUs. The $2,000 tier buys speed, not a fundamentally different capability.

Common beginner mistake

The mistake: Generating a Terraform config with the AI, running terraform apply, and discovering the next day a $5,000 AWS bill because the model generated 50 r5.8xlarge instances instead of 2 t3.medium. Why it fails: LLMs generate code — they see instance types as text tokens, not billing implications. The model has no concept of cost. It might generate an expensive GPU instance because it saw more examples of GPU instance configurations in its training data. The fix: Always review IaC generated by AI for: (1) instance types/counts — check for unreasonable scale, (2) IAM policies — models often generate overly permissive policies ("Action": "*"), (3) network configuration — verify security groups aren't open to 0.0.0.0/0, (4) cost — run infracost or terraform plan before applying. AI generates a draft. You audit it for production safety. Never apply AI-generated IaC without human review — the cost and security implications are too severe.

Reality check

Code models are LLM workloads — same VRAM math applies. 16 GB runs 13-32B Q4 (Qwen 2.5 Coder, DeepSeek Coder); 24 GB unlocks 70B-class code models. The killer detail is context window — code review wants 32K+, which pushes KV cache beyond 16 GB on 70B.

Common mistakes

  • Skipping context-window math (KV cache eats VRAM at scale)
  • Using base instruct models for code (specialized code models 30-50% better)
  • Running coding agent loops on 8 GB (works for 7B but agent loops compound)
  • Forgetting flash-attention impacts code workflows more than chat

What breaks first

The errors most operators hit when running infrastructure automation locally. Each links to a diagnose+fix walkthrough.

Before you buy

Verify your specific hardware can handle infrastructure automation before committing money.

Specialized buyer guides
Updated 2026 roundup