terraform-modules
Create reusable, composable Terraform modules with proper versioning and registry integration
What this skill does
# Terraform Modules Skill
Design and build production-ready, reusable Terraform modules following industry best practices.
## Module Structure
```
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
```
## Quick Start Template
### versions.tf
```hcl
terraform {
required_version = ">= 1.5.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.0, < 6.0"
}
}
}
```
### variables.tf
```hcl
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 = {}
}
```
### main.tf
```hcl
locals {
common_tags = merge(var.tags, {
Module = "my-module"
Environment = var.environment
})
}
resource "aws_resource" "main" {
name = var.name
tags = local.common_tags
}
```
### outputs.tf
```hcl
output "id" {
description = "Resource ID"
value = aws_resource.main.id
}
output "arn" {
description = "Resource ARN"
value = aws_resource.main.arn
}
```
## Input Patterns
### Required vs Optional
```hcl
# 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
}
```
### Complex Objects
```hcl
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 Patterns
### Conditional Outputs
```hcl
output "nat_gateway_ips" {
description = "NAT Gateway IPs (empty if not created)"
value = var.enable_nat ? aws_eip.nat[*].public_ip : []
}
```
### Structured Outputs
```hcl
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
}
}
```
### Sensitive Outputs
```hcl
output "credentials" {
description = "Database credentials"
value = {
username = aws_db_instance.main.username
password = random_password.db.result
}
sensitive = true
}
```
## Module Composition
### Root Module Calling Child Modules
```hcl
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]
}
```
### Using Registry Modules
```hcl
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
}
```
### for_each with Modules
```hcl
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
}
```
## Versioning
### Semantic Versioning
```hcl
# 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 Constraints
```hcl
version = "5.1.2" # Exact version
version = ">= 5.0" # Minimum version
version = "~> 5.0" # Minor version range
version = ">= 5.0, < 6.0" # Explicit range
```
## Troubleshooting
| 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 |
### Debug Commands
```bash
# Initialize modules
terraform init -upgrade
# Show module tree
terraform providers
# Validate module inputs
terraform validate
```
## Usage
```python
Skill("terraform-modules")
```
## Related
- **Agent**: 02-terraform-modules (PRIMARY_BOND)
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.