Terraform Patterns

Terraform infrastructure-as-code agent skill and plugin for Claude Code, Codex, Gemini CLI, Cursor, OpenClaw.

Development / Engineeringdevelopmentengineering
by AgentVoltv1.0.0Published 1y ago1 install
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

PromptDesign a multi-region Terraform deployment with shared state
Beforegeneric AI agent
Terraform is great for managing infrastructure, and multi-region deployments are powerful but complex. You'll want to organize your code into modules — compute modules, networking modules, storage modules — and then compose them for each region. State management is critical; you probably don't want to store state files locally. Something like Terraform Cloud or S3 backend with locking would be safer. You'll also want to think about variables and how to configure different regions differently. Testing your Terraform code helps catch errors before you deploy. Do you have an existing Terraform setup, or are you starting from scratch? That'll help me understand what patterns make sense.
Afterwith Terraform Patterns
MULTI-REGION ARCHITECTURE

MODULE STRUCTURE
• modules/vpc/ — Networking, subnets, security groups (reusable per region)
• modules/rds/ — Database with automated backups and read replicas
• modules/compute/ — App servers, auto-scaling groups, load balancing
• modules/dns/ — Route53 health checks, failover logic
• environments/prod/ — Region configs (us-east-1, eu-west-1, ap-southeast-1)

STATE MANAGEMENT
→ Backend: S3 + DynamoDB lock table (not Terraform Cloud — cost)
→ State path: prod/us-east-1/terraform.tfstate
→ Lock table: terraform-lock (on-demand billing)
→ Versioning: Enable S3 versioning for rollback

REGION CONFIGURATION (example: prod/us-east-1/main.tf)
module "vpc" {
  source = "../../modules/vpc"
  region = "us-east-1"
  vpc_cidr = "10.0.0.0/16"
}
module "rds" {
  source = "../../modules/rds"
  availability_zones = ["us-east-1a", "us-east-1b"]
}
→ Separate variables file per region
→ data.tf sources shared DNS zone

DEPLOYMENT SEQUENCE (blue-green pattern)
1. Terraform plan prod/us-east-1 (no auto-approve)
2. Code review (diff must be reviewed by 2 engineers)
3. terraform apply (human confirms after reading plan output)
4. Health checks: 5-minute post-apply validation
5. Repeat for next region (3-hour soak between regions)

DISASTER RECOVERY
• Backup plan: Weekly snapshots stored in separate AWS account
• Rollback: terraform destroy -> reapply from prior state version
• Testing: Staging environment mirrors prod (same modules, smaller instance sizes)

About this skill


name: terraform-patterns description: Use when Terraform infrastructure-as-code agent skill and plugin for Claude Code, Codex, Gemini CLI, Cursor, OpenClaw.

Terraform Patterns

Terraform infrastructure-as-code agent skill and plugin for Claude Code, Codex, Gemini CLI, Cursor, OpenClaw. Covers module design patterns, state management strategies, provider configuration, security hardening, policy-as-code with Sentinel/OPA, and CI/CD plan/apply workflows. Use when: user wants to design Terraform modules, manage state backends, review Terraform security, implement multi-region deployments, or follow IaC best practices.

What you get

  • Public GitHub repo (alirezarezvani/claude-skills)
  • the terraform-patterns skill folder with SKILL.md. Part of a 337-skill / 30-agent / 70-command install.

Customize your output

  • Fork the repo and adapt the skill's instructions and references to your workflow.

Example output

Activates automatically when your request matches Terraform Patterns; chains with the other skills, agents, and commands in the collection.

Best for

Creators, builders, and teams using Claude Code.

SKILL.md preview

SKILL.md
---
name: terraform-patterns
description: Use when designing Terraform modules, managing state backends, reviewing Terraform for security issues, or implementing multi-region deployments.
version: 1.0.0
category: Development / Engineering
author: AgentVolt
license: proprietary
tags:
  - development
  - engineering
---

# Terraform Patterns

Covers module design, state management, provider configuration, policy-as-code, and CI/CD plan and apply workflows for production infrastructure-as-code.

## When to use
- Designing a new Terraform module that needs to be reusable across environments

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →