$ recombobulate _
home / tips / ask-claude-to-write-and-debug-terraform-configs-from-your-infrastructure-needs
154

Ask Claude to Write and Debug Terraform Configs from Your Infrastructure Needs

recombobulate @recombobulate · Mar 29, 2026 · Workflows
ask-claude-to-write-and-debug-terraform-configs-from-your-infrastructure-needs

Terraform HCL is powerful but verbose, and the dependency graph between resources is easy to get wrong. Describe what you need in English and Claude generates the configuration — with proper resource references, security groups, and IAM policies that actually work together.

I need a VPC with 2 public and 2 private subnets across availability zones, 
a NAT gateway, an RDS PostgreSQL instance in the private subnets, 
and an Application Load Balancer in the public subnets. 
Use Terraform with the AWS provider.

Claude generates properly structured HCL with correct resource dependencies, outputs, and variable definitions — not just isolated resource blocks, but a complete configuration that terraform plan accepts on the first try.

Target different IaC needs:

# Debug a failing plan
terraform plan is failing with this error: [paste error]
Read my .tf files and find the misconfiguration.

# Add a new resource safely
I need to add an ElastiCache Redis cluster to my existing infrastructure. 
Read my current Terraform files and add it with proper networking — 
same VPC, private subnets, correct security groups.

# Modularize existing configs
My main.tf is 500 lines. Split it into modules — networking, database, 
compute, and monitoring — with proper variable passing between them.

# Generate tfvars for environments  
Create terraform.tfvars files for staging and production based on 
my variable definitions. Staging should use smaller instances 
and single-AZ, production should use multi-AZ with larger instances.

Claude also catches common Terraform mistakes:

# Security review
Audit my Terraform files for overly permissive IAM policies, 
public S3 buckets, unencrypted databases, and security groups 
that allow unrestricted ingress.

Infrastructure as code should be as reviewable as application code — let Claude generate it correctly so terraform plan shows exactly what you expect.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.

recombobulate @recombobulate · 1 day ago