areas/software/platform/skills/terraform-patterns/SKILL.md
# Skill: Terraform Patterns ## When to load When writing new Terraform, reviewing IaC PRs, designing module structure, or debugging plan/apply failures. ## Module Structure ``` terraform/ ├── modules/ │ ├── vpc/ │ ├── eks-cluster/ │ ├── rds-postgres/ │ └── static-site/ └── environments/ ├── staging/ │ ├── main.tf │ ├── variables.tf │ └── terraform.tfvars └── production/ ├── main.tf ├── variables.tf └── terraform.tfvars ``` **Rule**:
npx skillsauth add sawrus/agent-guides areas/software/platform/skills/terraform-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When writing new Terraform, reviewing IaC PRs, designing module structure, or debugging plan/apply failures.
terraform/
├── modules/
│ ├── vpc/
│ ├── eks-cluster/
│ ├── rds-postgres/
│ └── static-site/
└── environments/
├── staging/
│ ├── main.tf
│ ├── variables.tf
│ └── terraform.tfvars
└── production/
├── main.tf
├── variables.tf
└── terraform.tfvars
Rule: Modules must be generic. Environment-specific values live in tfvars, never hardcoded in modules.
resource "aws_s3_bucket" "this" {
bucket = "${var.project}-${var.environment}-assets-${random_id.suffix.hex}"
tags = merge(var.common_tags, { Name = "${var.project}-${var.environment}-assets" })
}
terraform {
backend "s3" {
bucket = "my-company-terraform-state"
key = "${var.project}/${var.environment}/terraform.tfstate"
region = "us-east-1"
encrypt = true
kms_key_id = "arn:aws:kms:us-east-1:123456789:key/..."
dynamodb_table = "terraform-state-lock"
}
}
# ✅ Scoped policy
resource "aws_iam_policy" "app_s3_read" {
policy = jsonencode({
Statement = [{
Effect = "Allow"
Action = ["s3:GetObject", "s3:ListBucket"]
Resource = [aws_s3_bucket.assets.arn, "${aws_s3_bucket.assets.arn}/*"]
}]
})
}
# ❌ Never: Action = ["s3:*"], Resource = ["*"]
| Anti-pattern | Fix |
|:---|:---|
| count for module variants | Use for_each with meaningful keys |
| Hardcoded AMI IDs | Use data "aws_ami" with filters |
| terraform_remote_state across all envs | Use SSM Parameter Store for cross-stack values |
testing
QA Expert for writing E2E tests, test scenarios, test plans, and ensuring test coverage quality.
development
Expert UI/UX design intelligence for creating distinctive, high-craft, and mobile-first interfaces. Focuses on premium aesthetics, touch-first ergonomics, and Flutter performance.
development
Code Review Expert for static analysis, security auditing, architecture review, and ensuring code quality standards.
development
Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep watching open PRs so fresh review feedback is surfaced promptly. Use when the user asks Codex to monitor a PR, watch CI, handle review comments, or keep an eye on failures and feedback on an open PR.