Build verifiable cloud and Kubernetes infrastructure with Claude Code, Codex, Terraform, OpenTofu, MCP, Helm, Crossplane, Trivy, Checkov, OPA, human-approved GitOps, policy checks, CI gates, and safe, spec-driven agent workflows.
Key Features
- Build and verify Terraform, OpenTofu, and Helm workflows with Claude Code, Codex CLI, and skills
- Connect MCP tools, enforce permissions, and check security, policy, plan, and cost evidence in CI
- Deliver cloud and Kubernetes proposals with CI checks, Argo CD, and human-approved GitOps pipelines
Book Description
The Agentic Infrastructure as Code Handbook is a practical guide to building cloud and Kubernetes infrastructure with AI coding agents, rather than relying on hand-written HCL and YAML alone. It shows DevOps engineers and platform teams how to move beyond ad hoc prompting and use context engineering, reusable agent skills, MCP servers, and spec-driven workflows to turn plain-language intent into Terraform and OpenTofu configurations, Helm charts, and Kubernetes manifests.
Each chapter builds on the last: workstation setup with Claude Code and Codex CLI, repository context and skills, MCP tool access, permissions and guardrails, and spec-driven generation. Learn to verify generated changes with Trivy, Checkov, OPA/Conftest, and optional Infracost cost estimates. Later chapters extend these practices to Kubernetes with Helm and Crossplane, then to GitHub Actions, Argo CD, and human-approved GitOps delivery. Explore bounded agent loops, multi-agent tradeoffs, and an end-to-end capstone.
Throughout, one rule holds: the agent proposes, the pipeline decides. Each increase in autonomy is paired with checks, evidence, and human review. Core exercises run locally, with AWS deployment optional. You'll finish with a repeatable approach to creating, verifying, and delivering infrastructure changes while keeping control over what ships.
What you will learn
- Understand IaC's seven eras and why agents change the trust model
- Set up Claude Code and Codex CLI for controlled agentic IaC work
- Engineer context, reusable skills, and harnesses for IaC agent tasks
- Connect agents to Terraform tools and live information through MCP
- Write specs that turn plain-language intent into verifiable Terraform
- Verify IaC with Trivy, Checkov, OPA/Conftest, and cost evidence
- Build Kubernetes workflows with Helm, Crossplane, and reconciliation
- Ship agent-proposed changes through CI gates and human-approved GitOps
Who this book is for
This book is for DevOps engineers, platform engineers, site reliability engineers (SREs), cloud and infrastructure engineers, system administrators, and infrastructure architects who want to introduce AI agents into their IaC workflows. It is also suitable for technical leads responsible for infrastructure reviews, approvals, and delivery. Readers should be comfortable with a terminal, Git, and basic cloud infrastructure concepts. Familiarity with Terraform or OpenTofu, Kubernetes, and CI/CD pipelines is helpful but not essential. No prior experience with AI agents or MCP is required.