terraform-modules

Solid

Design reusable, well-tested Terraform modules with cloud-agnostic interfaces and safe state management.

DevOps & Infrastructure 14 stars 3 forks Updated 3 days ago MIT

Install

View on GitHub

Quality Score: 86/100

Stars 20%
39
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Skill: Terraform Modules > **Expertise:** Reusable module design, for_each patterns, remote state, data sources, module testing with Terratest. ## When to load When writing new Terraform, reviewing IaC PRs, designing module interfaces, or debugging plan/apply failures. ## Module Interface Design ```hcl # variables.tf — define a clean, minimal interface variable "project" { description = "Project name used in resource naming and tags" type = string } variable "environment" { description = "Deployment environment (dev|staging|production)" type = string validation { condition = contains(["dev", "staging", "production"], var.environment) error_message = "environment must be dev, staging, or production." } } variable "instance_count" { description = "Number of instances to create" type = number default = 1 } # outputs.tf — expose only what callers need output "instance_ids" { description = "List of created instance IDs" value = aws_instance.this[*].id } output "private_ips" { description = "Private IP addresses" value = aws_instance.this[*].private_ip sensitive = false } ``` ## for_each vs count ```hcl # ✅ for_each — stable keys, safe to add/remove resource "aws_security_group_rule" "allow" { for_each = var.allowed_ports # map: { "http" = 80, "https" = 443 } type = "ingress" from_port = each.value to_port = each.value protocol = "tcp" cidr_blocks = ["0.0.0.0...

Details

Author
sawrus
Repository
sawrus/agent-guides
Created
3 months ago
Last Updated
3 days ago
Language
Shell
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category