Create reusable, composable Terraform modules with proper versioning and registry integration
Build production-ready Terraform modules with proper structure, versioning, and registry integration. Triggered when creating or refactoring Terraform modules, including variables, outputs, and module composition patterns.
/plugin marketplace add pluginagentmarketplace/custom-plugin-terraform/plugin install terraform-assistant@pluginagentmarketplace-terraformThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/schema.jsonreferences/GUIDE.mdreferences/PATTERNS.mdscripts/validate.pyDesign and build production-ready, reusable Terraform modules following industry best practices.
my-module/
├── main.tf # Primary resources
├── variables.tf # Input declarations
├── outputs.tf # Output declarations
├── versions.tf # Provider requirements
├── locals.tf # Computed values
├── README.md # Documentation
├── examples/
│ ├── basic/
│ └── complete/
└── tests/
└── module_test.go
terraform {
required_version = ">= 1.5.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0, < 6.0"
}
}
}
variable "name" {
type = string
description = "Resource name prefix"
validation {
condition = length(var.name) <= 32
error_message = "Name must be 32 characters or less."
}
}
variable "environment" {
type = string
description = "Deployment environment"
validation {
condition = contains(["dev", "staging", "prod"], var.environment)
error_message = "Must be dev, staging, or prod."
}
}
variable "tags" {
type = map(string)
description = "Resource tags"
default = {}
}
locals {
common_tags = merge(var.tags, {
Module = "my-module"
Environment = var.environment
})
}
resource "aws_resource" "main" {
name = var.name
tags = local.common_tags
}
output "id" {
description = "Resource ID"
value = aws_resource.main.id
}
output "arn" {
description = "Resource ARN"
value = aws_resource.main.arn
}
# Required - no default
variable "vpc_id" {
type = string
description = "VPC ID (required)"
}
# Optional with default
variable "instance_type" {
type = string
description = "EC2 instance type"
default = "t3.micro"
}
# Optional nullable
variable "kms_key_arn" {
type = string
description = "KMS key ARN (null = use default)"
default = null
}
variable "scaling_config" {
type = object({
min_size = number
max_size = number
desired_capacity = optional(number)
metrics = optional(list(string), ["CPUUtilization"])
})
default = {
min_size = 1
max_size = 3
}
validation {
condition = var.scaling_config.min_size <= var.scaling_config.max_size
error_message = "min_size must be <= max_size."
}
}
output "nat_gateway_ips" {
description = "NAT Gateway IPs (empty if not created)"
value = var.enable_nat ? aws_eip.nat[*].public_ip : []
}
output "cluster_config" {
description = "Cluster configuration for kubectl"
value = {
endpoint = aws_eks_cluster.main.endpoint
ca_certificate = aws_eks_cluster.main.certificate_authority[0].data
name = aws_eks_cluster.main.name
}
}
output "credentials" {
description = "Database credentials"
value = {
username = aws_db_instance.main.username
password = random_password.db.result
}
sensitive = true
}
module "vpc" {
source = "./modules/vpc"
name = var.project_name
cidr_block = var.vpc_cidr
environment = var.environment
}
module "eks" {
source = "./modules/eks"
cluster_name = var.project_name
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnet_ids
depends_on = [module.vpc]
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "5.1.2" # Pin exact version
name = var.project_name
cidr = var.vpc_cidr
azs = data.aws_availability_zones.available.names
private_subnets = var.private_subnet_cidrs
public_subnets = var.public_subnet_cidrs
}
module "services" {
source = "./modules/ecs-service"
for_each = var.services
name = each.key
container_port = each.value.port
cpu = each.value.cpu
memory = each.value.memory
cluster_id = aws_ecs_cluster.main.id
}
# Major: Breaking changes
# Minor: New features, backward compatible
# Patch: Bug fixes
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 5.0" # >= 5.0.0, < 6.0.0
}
module "internal" {
source = "git::https://github.com/org/modules.git//vpc?ref=v2.3.0"
}
version = "5.1.2" # Exact version
version = ">= 5.0" # Minimum version
version = "~> 5.0" # Minor version range
version = ">= 5.0, < 6.0" # Explicit range
| Error | Cause | Solution |
|---|---|---|
Module not found | Wrong path/URL | Verify source path |
Unsupported argument | Version mismatch | Check changelog |
Cycle detected | Circular references | Restructure dependencies |
Count/for_each conflict | Both used together | Use only one |
# Initialize modules
terraform init -upgrade
# Show module tree
terraform providers
# Validate module inputs
terraform validate
Skill("terraform-modules")
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.