[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75K4SS7YXEB3A4H2WCMH53T":3,"skill-same:01M75K4SS7YXEB3A4H2WCMH53T":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":35,"ownerDescription":6,"updatedAt":36,"install":37,"resources":50},"01M75K4SS7YXEB3A4H2WCMH53T","terraform-patterns",null,"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\u002FOPA, and CI\u002FCD plan\u002Fapply workflows. Use when: user wants to design Terraform modules, manage state backends, review Terraform security, implement multi-region deployments, or follow IaC best practices.","agisota\u002Fold-one","agisota","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121413592?v=4","01M75B4BRNT67EC1NDRT8QZEP2","01M75B4BS7QR9VP580MSCPTS3X",3,"MIT","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fterraform-patterns\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: \"terraform-patterns\"\ndescription: \"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\u002FOPA, and CI\u002FCD plan\u002Fapply workflows. Use when: user wants to design Terraform modules, manage state backends, review Terraform security, implement multi-region deployments, or follow IaC best practices.\"\nlicense: MIT\nmetadata:\n  version: 1.0.0\n  author: Alireza Rezvani\n  category: engineering\n  updated: 2026-03-15\n---\n\n# Terraform Patterns\n\n> Predictable infrastructure. Secure state. Modules that compose. No drift.\n\nOpinionated Terraform workflow that turns sprawling HCL into well-structured, secure, production-grade infrastructure code. Covers module design, state management, provider patterns, security hardening, and CI\u002FCD integration.\n\nNot a Terraform tutorial — a set of concrete decisions about how to write infrastructure code that doesn't break at 3 AM.\n\n---\n\n## Slash Commands\n\n| Command | What it does |\n|---------|-------------|\n| `\u002Fterraform:review` | Analyze Terraform code for anti-patterns, security issues, and structure problems |\n| `\u002Fterraform:module` | Design or refactor a Terraform module with proper inputs, outputs, and composition |\n| `\u002Fterraform:security` | Audit Terraform code for security vulnerabilities, secrets exposure, and IAM misconfigurations |\n\n---\n\n## When This Skill Activates\n\nRecognize these patterns from the user:\n\n- \"Review this Terraform code\"\n- \"Design a Terraform module for...\"\n- \"My Terraform state is...\"\n- \"Set up remote state backend\"\n- \"Multi-region Terraform deployment\"\n- \"Terraform security review\"\n- \"Module structure best practices\"\n- \"Terraform CI\u002FCD pipeline\"\n- Any request involving: `.tf` files, HCL, Terraform modules, state management, provider configuration, infrastructure-as-code\n\nIf the user has `.tf` files or wants to provision infrastructure with Terraform → this skill applies.\n\n---\n\n## Workflow\n\n### `\u002Fterraform:review` — Terraform Code Review\n\n1. **Analyze current state**\n   - Read all `.tf` files in the target directory\n   - Identify module structure (flat vs nested)\n   - Count resources, data sources, variables, outputs\n   - Check naming conventions\n\n2. **Apply review checklist**\n\n   ```\n   MODULE STRUCTURE\n   ├── Variables have descriptions and type constraints\n   ├── Outputs expose only what consumers need\n   ├── Resources use consistent naming: {provider}_{type}_{purpose}\n   ├── Locals used for computed values and DRY expressions\n   └── No hardcoded values — everything parameterized or in locals\n\n   STATE & BACKEND\n   ├── Remote backend configured (S3, GCS, Azure Blob, Terraform Cloud)\n   ├── State locking enabled (DynamoDB for S3, native for others)\n   ├── State encryption at rest enabled\n   ├── No secrets stored in state (or state access is restricted)\n   └── Workspaces or directory isolation for environments\n\n   PROVIDERS\n   ├── Version constraints use pessimistic operator: ~> 5.0\n   ├── Required providers block in terraform {} block\n   ├── Provider aliases for multi-region or multi-account\n   └── No provider configuration in child modules\n\n   SECURITY\n   ├── No hardcoded secrets, keys, or passwords\n   ├── IAM follows least-privilege principle\n   ├── Encryption enabled for storage, databases, secrets\n   ├── Security groups are not overly permissive (no 0.0.0.0\u002F0 ingress on sensitive ports)\n   └── Sensitive variables marked with sensitive = true\n   ```\n\n3. **Generate report**\n   ```bash\n   python3 scripts\u002Ftf_module_analyzer.py .\u002Fterraform\n   ```\n\n4. **Run security scan**\n   ```bash\n   python3 scripts\u002Ftf_security_scanner.py .\u002Fterraform\n   ```\n\n### `\u002Fterraform:module` — Module Design\n\n1. **Identify module scope**\n   - Single responsibility: one module = one logical grouping\n   - Determine inputs (variables), outputs, and resource boundaries\n   - Decide: flat module (single directory) vs nested (calling child modules)\n\n2. **Apply module design checklist**\n\n   ```\n   STRUCTURE\n   ├── main.tf        — Primary resources\n   ├── variables.tf   — All input variables with descriptions and types\n   ├── outputs.tf     — All outputs with descriptions\n   ├── versions.tf    — terraform {} block with required_providers\n   ├── locals.tf      — Computed values and naming conventions\n   ├── data.tf        — Data sources (if any)\n   └── README.md      — Usage examples and variable documentation\n\n   VARIABLES\n   ├── Every variable has: description, type, validation (where applicable)\n   ├── Sensitive values marked: sensitive = true\n   ├── Defaults provided for optional settings\n   ├── Use object types for related settings: variable \"config\" { type = object({...}) }\n   └── Validate with: validation { condition = ... }\n\n   OUTPUTS\n   ├── Output IDs, ARNs, endpoints — things consumers need\n   ├── Include description on every output\n   ├── Mark sensitive outputs: sensitive = true\n   └── Don't output entire resources — only specific attributes\n\n   COMPOSITION\n   ├── Root module calls child modules\n   ├── Child modules never call other child modules\n   ├── Pass values explicitly — no hidden data source lookups in child modules\n   ├── Provider configuration only in root module\n   └── Use module \"name\" { source = \".\u002Fmodules\u002Fname\" }\n   ```\n\n3. **Generate module scaffold**\n   - Output file structure with boilerplate\n   - Include variable validation blocks\n   - Add lifecycle rules where appropriate\n\n### `\u002Fterraform:security` — Security Audit\n\n1. **Code-level audit**\n\n   | Check | Severity | Fix |\n   |-------|----------|-----|\n   | Hardcoded secrets in `.tf` files | Critical | Use variables with sensitive = true or vault |\n   | IAM policy with `*` actions | Critical | Scope to specific actions and resources |\n   | Security group with 0.0.0.0\u002F0 on port 22\u002F3389 | Critical | Restrict to known CIDR blocks or use SSM\u002Fbastion |\n   | S3 bucket without encryption | High | Add `server_side_encryption_configuration` block |\n   | S3 bucket with public access | High | Add `aws_s3_bucket_public_access_block` |\n   | RDS without encryption | High | Set `storage_encrypted = true` |\n   | RDS publicly accessible | High | Set `publicly_accessible = false` |\n   | CloudTrail not enabled | Medium | Add `aws_cloudtrail` resource |\n   | Missing `prevent_destroy` on stateful resources | Medium | Add `lifecycle { prevent_destroy = true }` |\n   | Variables without `sensitive = true` for secrets | Medium | Add `sensitive = true` to secret variables |\n\n2. **State security audit**\n\n   | Check | Severity | Fix |\n   |-------|----------|-----|\n   | Local state file | Critical | Migrate to remote backend with encryption |\n   | Remote state without encryption | High | Enable encryption on backend (SSE-S3, KMS) |\n   | No state locking | High | Enable DynamoDB for S3, native for TF Cloud |\n   | State accessible to all team members | Medium | Restrict via IAM policies or TF Cloud teams |\n\n3. **Generate security report**\n   ```bash\n   python3 scripts\u002Ftf_security_scanner.py .\u002Fterraform\n   python3 scripts\u002Ftf_security_scanner.py .\u002Fterraform --output json\n   ```\n\n---\n\n## Tooling\n\n### `scripts\u002Ftf_module_analyzer.py`\n\nCLI utility for analyzing Terraform directory structure and module quality.\n\n**Features:**\n- Resource and data source counting\n- Variable and output analysis (missing descriptions, types, validation)\n- Naming convention checks\n- Module composition detection\n- File structure validation\n- JSON and text output\n\n**Usage:**\n```bash\n# Analyze a Terraform directory\npython3 scripts\u002Ftf_module_analyzer.py .\u002Fterraform\n\n# JSON output\npython3 scripts\u002Ftf_module_analyzer.py .\u002Fterraform --output json\n\n# Analyze a specific module\npython3 scripts\u002Ftf_module_analyzer.py .\u002Fmodules\u002Fvpc\n```\n\n### `scripts\u002Ftf_security_scanner.py`\n\nCLI utility for scanning `.tf` files for common security issues.\n\n**Features:**\n- Hardcoded secret detection (AWS keys, passwords, tokens)\n- Overly permissive IAM policy detection\n- Open security group detection (0.0.0.0\u002F0 on sensitive ports)\n- Missing encryption checks (S3, RDS, EBS)\n- Public access detection (S3, RDS, EC2)\n- Sensitive variable audit\n- JSON and text output\n\n**Usage:**\n```bash\n# Scan a Terraform directory\npython3 scripts\u002Ftf_security_scanner.py .\u002Fterraform\n\n# JSON output\npython3 scripts\u002Ftf_security_scanner.py .\u002Fterraform --output json\n\n# Strict mode (elevate warnings)\npython3 scripts\u002Ftf_security_scanner.py .\u002Fterraform --strict\n```\n\n---\n\n## Module Design Patterns\n\n### Pattern 1: Flat Module (Small\u002FMedium Projects)\n\n```\ninfrastructure\u002F\n├── main.tf          # All resources\n├── variables.tf     # All inputs\n├── outputs.tf       # All outputs\n├── versions.tf      # Provider requirements\n├── terraform.tfvars # Environment values (not committed)\n└── backend.tf       # Remote state configuration\n```\n\nBest for: Single application, \u003C 20 resources, one team owns everything.\n\n### Pattern 2: Nested Modules (Medium\u002FLarge Projects)\n\n```\ninfrastructure\u002F\n├── environments\u002F\n│   ├── dev\u002F\n│   │   ├── main.tf          # Calls modules with dev params\n│   │   ├── backend.tf       # Dev state backend\n│   │   └── terraform.tfvars\n│   ├── staging\u002F\n│   │   └── ...\n│   └── prod\u002F\n│       └── ...\n├── modules\u002F\n│   ├── networking\u002F\n│   │   ├── main.tf\n│   │   ├── variables.tf\n│   │   └── outputs.tf\n│   ├── compute\u002F\n│   │   └── ...\n│   └── database\u002F\n│       └── ...\n└── versions.tf\n```\n\nBest for: Multiple environments, shared infrastructure patterns, team collaboration.\n\n### Pattern 3: Mono-Repo with Terragrunt\n\n```\ninfrastructure\u002F\n├── terragrunt.hcl           # Root config\n├── modules\u002F                  # Reusable modules\n│   ├── vpc\u002F\n│   ├── eks\u002F\n│   └── rds\u002F\n├── dev\u002F\n│   ├── terragrunt.hcl       # Dev overrides\n│   ├── vpc\u002F\n│   │   └── terragrunt.hcl   # Module invocation\n│   └── eks\u002F\n│       └── terragrunt.hcl\n└── prod\u002F\n    ├── terragrunt.hcl\n    └── ...\n```\n\nBest for: Large-scale, many environments, DRY configuration, team-level isolation.\n\n---\n\n## Provider Configuration Patterns\n\n### Version Pinning\n```hcl\nterraform {\n  required_version = \">= 1.5.0\"\n\n  required_providers {\n    aws = {\n      source  = \"hashicorp\u002Faws\"\n      version = \"~> 5.0\"    # Allow 5.x, block 6.0\n    }\n    random = {\n      source  = \"hashicorp\u002Frandom\"\n      version = \"~> 3.5\"\n    }\n  }\n}\n```\n\n### Multi-Region with Aliases\n```hcl\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n\nprovider \"aws\" {\n  alias  = \"west\"\n  region = \"us-west-2\"\n}\n\nresource \"aws_s3_bucket\" \"primary\" {\n  bucket = \"my-app-primary\"\n}\n\nresource \"aws_s3_bucket\" \"replica\" {\n  provider = aws.west\n  bucket   = \"my-app-replica\"\n}\n```\n\n### Multi-Account with Assume Role\n```hcl\nprovider \"aws\" {\n  alias  = \"production\"\n  region = \"us-east-1\"\n\n  assume_role {\n    role_arn = \"arn:aws:iam::PROD_ACCOUNT_ID:role\u002FTerraformRole\"\n  }\n}\n```\n\n---\n\n## State Management Decision Tree\n\n```\nSingle developer, small project?\n├── Yes → Local state (but migrate to remote ASAP)\n└── No\n    ├── Using Terraform Cloud\u002FEnterprise?\n    │   └── Yes → TF Cloud native backend (built-in locking, encryption, RBAC)\n    └── No\n        ├── AWS?\n        │   └── S3 + DynamoDB (encryption, locking, versioning)\n        ├── GCP?\n        │   └── GCS bucket (native locking, encryption)\n        ├── Azure?\n        │   └── Azure Blob Storage (native locking, encryption)\n        └── Other?\n            └── Consul or PostgreSQL backend\n\nEnvironment isolation strategy:\n├── Separate state files per environment (recommended)\n│   ├── Option A: Separate directories (dev\u002F, staging\u002F, prod\u002F)\n│   └── Option B: Terraform workspaces (simpler but less isolation)\n└── Single state file for all environments (never do this)\n```\n\n---\n\n## CI\u002FCD Integration Patterns\n\n### GitHub Actions Plan\u002FApply\n\n```yaml\n# .github\u002Fworkflows\u002Fterraform.yml\nname: Terraform\non:\n  pull_request:\n    paths: ['terraform\u002F**']\n  push:\n    branches: [main]\n    paths: ['terraform\u002F**']\n\njobs:\n  plan:\n    runs-on: ubuntu-latest\n    if: github.event_name == 'pull_request'\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: hashicorp\u002Fsetup-terraform@v3\n      - run: terraform init\n      - run: terraform validate\n      - run: terraform plan -out=tfplan\n      - run: terraform show -json tfplan > plan.json\n      # Post plan as PR comment\n\n  apply:\n    runs-on: ubuntu-latest\n    if: github.ref == 'refs\u002Fheads\u002Fmain' && github.event_name == 'push'\n    environment: production\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: hashicorp\u002Fsetup-terraform@v3\n      - run: terraform init\n      - run: terraform apply -auto-approve\n```\n\n### Drift Detection\n\n```yaml\n# Run on schedule to detect drift\nname: Drift Detection\non:\n  schedule:\n    - cron: '0 6 * * 1-5'  # Weekdays at 6 AM\n\njobs:\n  detect:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: hashicorp\u002Fsetup-terraform@v3\n      - run: terraform init\n      - run: |\n          terraform plan -detailed-exitcode -out=drift.tfplan 2>&1 | tee drift.log\n          EXIT_CODE=$?\n          if [ $EXIT_CODE -eq 2 ]; then\n            echo \"DRIFT DETECTED — review drift.log\"\n            # Send alert (Slack, PagerDuty, etc.)\n          fi\n```\n\n---\n\n## Proactive Triggers\n\nFlag these without being asked:\n\n- **No remote backend configured** → Migrate to S3\u002FGCS\u002FAzure Blob with locking and encryption.\n- **Provider without version constraint** → Add `version = \"~> X.0\"` to prevent breaking upgrades.\n- **Hardcoded secrets in .tf files** → Use variables with `sensitive = true`, or integrate Vault\u002FSSM.\n- **IAM policy with `\"Action\": \"*\"`** → Scope to specific actions. No wildcard actions in production.\n- **Security group open to 0.0.0.0\u002F0 on SSH\u002FRDP** → Restrict to bastion CIDR or use SSM Session Manager.\n- **No state locking** → Enable DynamoDB table for S3 backend, or use TF Cloud.\n- **Resources without tags** → Add default_tags in provider block. Tags are mandatory for cost tracking.\n- **Missing `prevent_destroy` on databases\u002Fstorage** → Add lifecycle block to prevent accidental deletion.\n\n---\n\n## Multi-Cloud Provider Configuration\n\nWhen a single root module must provision across AWS, Azure, and GCP simultaneously.\n\n### Provider Aliasing Pattern\n\n```hcl\nterraform {\n  required_providers {\n    aws = {\n      source  = \"hashicorp\u002Faws\"\n      version = \"~> 5.0\"\n    }\n    azurerm = {\n      source  = \"hashicorp\u002Fazurerm\"\n      version = \"~> 3.0\"\n    }\n    google = {\n      source  = \"hashicorp\u002Fgoogle\"\n      version = \"~> 5.0\"\n    }\n  }\n}\n\nprovider \"aws\" {\n  region = var.aws_region\n}\n\nprovider \"azurerm\" {\n  features {}\n  subscription_id = var.azure_subscription_id\n}\n\nprovider \"google\" {\n  project = var.gcp_project_id\n  region  = var.gcp_region\n}\n```\n\n### Shared Variables Across Providers\n\n```hcl\nvariable \"environment\" {\n  description = \"Environment name used across all providers\"\n  type        = string\n  validation {\n    condition     = contains([\"dev\", \"staging\", \"prod\"], var.environment)\n    error_message = \"Must be dev, staging, or prod.\"\n  }\n}\n\nlocals {\n  common_tags = {\n    environment = var.environment\n    managed_by  = \"terraform\"\n    project     = var.project_name\n  }\n}\n```\n\n### When to Use Multi-Cloud\n\n- **Yes**: Regulatory requirements mandate data residency across providers, or the org has existing workloads on multiple clouds.\n- **No**: \"Avoiding vendor lock-in\" alone is not sufficient justification. Multi-cloud doubles operational complexity. Prefer single-cloud unless there is a concrete business requirement.\n\n---\n\n## OpenTofu Compatibility\n\nOpenTofu is an open-source fork of Terraform maintained by the Linux Foundation under the MPL 2.0 license.\n\n### Migration from Terraform to OpenTofu\n\n```bash\n# 1. Install OpenTofu\nbrew install opentofu        # macOS\nsnap install --classic tofu  # Linux\n\n# 2. Replace the binary — state files are compatible\ntofu init                    # Re-initializes with OpenTofu\ntofu plan                    # Identical plan output\ntofu apply                   # Same apply workflow\n```\n\n### License Considerations\n\n| | Terraform (1.6+) | OpenTofu |\n|---|---|---|\n| **License** | BSL 1.1 (source-available) | MPL 2.0 (open-source) |\n| **Commercial use** | Restricted for competing products | Unrestricted |\n| **Community governance** | HashiCorp | Linux Foundation |\n\n### Feature Parity\n\nOpenTofu tracks Terraform 1.6.x features. Key additions unique to OpenTofu:\n- Client-side state encryption (`tofu init -encryption`)\n- Early variable\u002Flocals evaluation\n- Provider-defined functions\n\n### When to Choose OpenTofu\n\n- You need a fully open-source license for your supply chain.\n- You want client-side state encryption without Terraform Cloud.\n- Otherwise, either tool works — the HCL syntax and provider ecosystem are identical.\n\n---\n\n## Infracost Integration\n\nInfracost estimates cloud costs from Terraform code before resources are provisioned.\n\n### PR Workflow\n\n```bash\n# Show cost breakdown for current code\ninfracost breakdown --path .\n\n# Compare cost difference between current branch and main\ninfracost diff --path . --compare-to infracost-base.json\n```\n\n### GitHub Actions Cost Comment\n\n```yaml\n# .github\u002Fworkflows\u002Finfracost.yml\nname: Infracost\non: [pull_request]\n\njobs:\n  cost:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: infracost\u002Factions\u002Fsetup@v3\n        with:\n          api-key: ${{ secrets.INFRACOST_API_KEY }}\n      - run: infracost breakdown --path .\u002Fterraform --format json --out-file \u002Ftmp\u002Finfracost.json\n      - run: infracost comment github --path \u002Ftmp\u002Finfracost.json --repo $GITHUB_REPOSITORY --pull-request ${{ github.event.pull_request.number }} --github-token ${{ secrets.GITHUB_TOKEN }} --behavior update\n```\n\n### Budget Thresholds and Cost Policy\n\n```yaml\n# infracost.yml — policy file\nversion: 0.1\npolicies:\n  - path: \"*\"\n    max_monthly_cost: \"5000\"    # Fail PR if estimated cost exceeds $5,000\u002Fmonth\n    max_cost_increase: \"500\"    # Fail PR if cost increase exceeds $500\u002Fmonth\n```\n\n---\n\n## Import Existing Infrastructure\n\nBring manually-created resources under Terraform management.\n\n### terraform import Workflow\n\n```bash\n# 1. Write the resource block first (empty body is fine)\n# main.tf:\n# resource \"aws_s3_bucket\" \"legacy\" {}\n\n# 2. Import the resource into state\nterraform import aws_s3_bucket.legacy my-existing-bucket-name\n\n# 3. Run plan to see attribute diff\nterraform plan\n\n# 4. Fill in the resource block until plan shows no changes\n```\n\n### Bulk Import with Config Generation (Terraform 1.5+)\n\n```bash\n# Generate HCL for imported resources\nterraform plan -generate-config-out=generated.tf\n\n# Review generated.tf, then move resources into proper files\n```\n\n### Common Pitfalls\n\n- **Resource drift after import**: The imported resource may have attributes Terraform does not manage. Run `terraform plan` immediately and resolve every diff.\n- **State manipulation**: Use `terraform state mv` to rename or reorganize. Use `terraform state rm` to remove without destroying. Always back up state before manipulation: `terraform state pull > backup.tfstate`.\n- **Sensitive defaults**: Imported resources may expose secrets in state. Restrict state access and enable encryption.\n\n---\n\n## Terragrunt Patterns\n\nTerragrunt is a thin wrapper around Terraform that provides DRY configuration for multi-environment setups.\n\n### Root terragrunt.hcl (Shared Config)\n\n```hcl\n# terragrunt.hcl (root)\nremote_state {\n  backend = \"s3\"\n  generate = {\n    path      = \"backend.tf\"\n    if_exists = \"overwrite_terragrunt\"\n  }\n  config = {\n    bucket         = \"my-org-terraform-state\"\n    key            = \"${path_relative_to_include()}\u002Fterraform.tfstate\"\n    region         = \"us-east-1\"\n    encrypt        = true\n    dynamodb_table = \"terraform-locks\"\n  }\n}\n```\n\n### Child terragrunt.hcl (Environment Override)\n\n```hcl\n# prod\u002Fvpc\u002Fterragrunt.hcl\ninclude \"root\" {\n  path = find_in_parent_folders()\n}\n\nterraform {\n  source = \"..\u002F..\u002Fmodules\u002Fvpc\"\n}\n\ninputs = {\n  environment = \"prod\"\n  cidr_block  = \"10.0.0.0\u002F16\"\n}\n```\n\n### Dependencies Between Modules\n\n```hcl\n# prod\u002Feks\u002Fterragrunt.hcl\ndependency \"vpc\" {\n  config_path = \"..\u002Fvpc\"\n}\n\ninputs = {\n  vpc_id     = dependency.vpc.outputs.vpc_id\n  subnet_ids = dependency.vpc.outputs.private_subnet_ids\n}\n```\n\n### When Terragrunt Adds Value\n\n- **Yes**: 3+ environments with identical module structure, shared backend config, or cross-module dependencies.\n- **No**: Single environment, small team, or simple directory-based isolation already works. Terragrunt adds a learning curve and another binary to manage.\n\n---\n\n## Installation\n\n### One-liner (any tool)\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Falirezarezvani\u002Fclaude-skills.git\ncp -r claude-skills\u002Fengineering\u002Fterraform-patterns ~\u002F.claude\u002Fskills\u002F\n```\n\n### Multi-tool install\n```bash\n.\u002Fscripts\u002Fconvert.sh --skill terraform-patterns --tool codex|gemini|cursor|windsurf|openclaw\n```\n\n### OpenClaw\n```bash\nclawhub install terraform-patterns\n```\n\n---\n\n## Related Skills\n\n- **senior-devops** — Broader DevOps scope (CI\u002FCD, monitoring, containerization). Complementary — use terraform-patterns for IaC-specific work, senior-devops for pipeline and infrastructure operations.\n- **aws-solution-architect** — AWS architecture design. Complementary — terraform-patterns implements the infrastructure, aws-solution-architect designs it.\n- **senior-security** — Application security. Complementary — terraform-patterns covers infrastructure security posture, senior-security covers application-level threats.\n- **ci-cd-pipeline-builder** — Pipeline construction. Complementary — terraform-patterns defines infrastructure, ci-cd-pipeline-builder automates deployment.\n","# Terraform Patterns\n\n> Predictable infrastructure. Secure state. Modules that compose. No drift.\n\nOpinionated Terraform workflow that turns sprawling HCL into well-structured, secure, production-grade infrastructure code. Covers module design, state management, provider patterns, security hardening, and CI\u002FCD integration.\n\nNot a Terraform tutorial — a set of concrete decisions about how to write infrastructure code that doesn't break at 3 AM.\n\n---\n\n## Slash Commands\n\n| Command | What it does |\n|---------|-------------|\n| `\u002Fterraform:review` | Analyze Terraform code for anti-patterns, security issues, and structure problems |\n| `\u002Fterraform:module` | Design or refactor a Terraform module with proper inputs, outputs, and composition |\n| `\u002Fterraform:security` | Audit Terraform code for security vulnerabilities, secrets exposure, and IAM misconfigurations |\n\n---\n\n## When This Skill Activates\n\nRecognize these patterns from the user:\n\n- \"Review this Terraform code\"\n- \"Design a Terraform module for...\"\n- \"My Terraform state is...\"\n- \"Set up remote state backend\"\n- \"Multi-region Terraform deployment\"\n- \"Terraform security review\"\n- \"Module structure best practices\"\n- \"Terraform CI\u002FCD pipeline\"\n- Any request involving: `.tf` files, HCL, Terraform modules, state management, provider configuration, infrastructure-as-code\n\nIf the user has `.tf` files or wants to provision infrastructure with Terraform → this skill applies.\n\n---\n\n## Workflow\n\n### `\u002Fterraform:review` — Terraform Code Review\n\n1. **Analyze current state**\n   - Read all `.tf` files in the target directory\n   - Identify module structure (flat vs nested)\n   - Count resources, data sources, variables, outputs\n   - Check naming conventions\n\n2. **Apply review checklist**\n\n   ```\n   MODULE STRUCTURE\n   ├── Variables have descriptions and type constraints\n   ├── Outputs expose only what consumers need\n   ├── Resources use consistent naming: {provider}_{type}_{purpose}\n   ├── Locals used for computed values and DRY expressions\n   └── No hardcoded values — everything parameterized or in locals\n\n   STATE & BACKEND\n   ├── Remote backend configured (S3, GCS, Azure Blob, Terraform Cloud)\n   ├── State locking enabled (DynamoDB for S3, native for others)\n   ├── State encryption at rest enabled\n   ├── No secrets stored in state (or state access is restricted)\n   └── Workspaces or directory isolation for environments\n\n   PROVIDERS\n   ├── Version constraints use pessimistic operator: ~> 5.0\n   ├── Required providers block in terraform {} block\n   ├── Provider aliases for multi-region or multi-account\n   └── No provider configuration in child modules\n\n   SECURITY\n   ├── No hardcoded secrets, keys, or passwords\n   ├── IAM follows least-privilege principle\n   ├── Encryption enabled for storage, databases, secrets\n   ├── Security groups are not overly permissive (no 0.0.0.0\u002F0 ingress on sensitive ports)\n   └── Sensitive variables marked with sensitive = true\n   ```\n\n3. **Generate report**\n   ```bash\n   python3 scripts\u002Ftf_module_analyzer.py .\u002Fterraform\n   ```\n\n4. **Run security scan**\n   ```bash\n   python3 scripts\u002Ftf_security_scanner.py .\u002Fterraform\n   ```\n\n### `\u002Fterraform:module` — Module Design\n\n1. **Identify module scope**\n   - Single responsibility: one module = one logical grouping\n   - Determine inputs (variables), outputs, and resource boundaries\n   - Decide: flat module (single directory) vs nested (calling child modules)\n\n2. **Apply module design checklist**\n\n   ```\n   STRUCTURE\n   ├── main.tf        — Primary resources\n   ├── variables.tf   — All input variables with descriptions and types\n   ├── outputs.tf     — All outputs with descriptions\n   ├── versions.tf    — terraform {} block with required_providers\n   ├── locals.tf      — Computed values and naming conventions\n   ├── data.tf        — Data sources (if any)\n   └── README.md      — Usage examples and variable documentation\n\n   VARIABLES\n   ├── Every variable has: description, type, validation (where applicable)\n   ├── Sensitive values marked: sensitive = true\n   ├── Defaults provided for optional settings\n   ├── Use object types for related settings: variable \"config\" { type = object({...}) }\n   └── Validate with: validation { condition = ... }\n\n   OUTPUTS\n   ├── Output IDs, ARNs, endpoints — things consumers need\n   ├── Include description on every output\n   ├── Mark sensitive outputs: sensitive = true\n   └── Don't output entire resources — only specific attributes\n\n   COMPOSITION\n   ├── Root module calls child modules\n   ├── Child modules never call other child modules\n   ├── Pass values explicitly — no hidden data source lookups in child modules\n   ├── Provider configuration only in root module\n   └── Use module \"name\" { source = \".\u002Fmodules\u002Fname\" }\n   ```\n\n3. **Generate module scaffold**\n   - Output file structure with boilerplate\n   - Include variable validation blocks\n   - Add lifecycle rules where appropriate\n\n### `\u002Fterraform:security` — Security Audit\n\n1. **Code-level audit**\n\n   | Check | Severity | Fix |\n   |-------|----------|-----|\n   | Hardcoded secrets in `.tf` files | Critical | Use variables with sensitive = true or vault |\n   | IAM policy with `*` actions | Critical | Scope to specific actions and resources |\n   | Security group with 0.0.0.0\u002F0 on port 22\u002F3389 | Critical | Restrict to known CIDR blocks or use SSM\u002Fbastion |\n   | S3 bucket without encryption | High | Add `server_side_encryption_configuration` block |\n   | S3 bucket with public access | High | Add `aws_s3_bucket_public_access_block` |\n   | RDS without encryption | High | Set `storage_encrypted = true` |\n   | RDS publicly accessible | High | Set `publicly_accessible = false` |\n   | CloudTrail not enabled | Medium | Add `aws_cloudtrail` resource |\n   | Missing `prevent_destroy` on stateful resources | Medium | Add `lifecycle { prevent_destroy = true }` |\n   | Variables without `sensitive = true` for secrets | Medium | Add `sensitive = true` to secret variables |\n\n2. **State security audit**\n\n   | Check | Severity | Fix |\n   |-------|----------|-----|\n   | Local state file | Critical | Migrate to remote backend with encryption |\n   | Remote state without encryption | High | Enable encryption on backend (SSE-S3, KMS) |\n   | No state locking | High | Enable DynamoDB for S3, native for TF Cloud |\n   | State accessible to all team members | Medium | Restrict via IAM policies or TF Cloud teams |\n\n3. **Generate security report**\n   ```bash\n   python3 scripts\u002Ftf_security_scanner.py .\u002Fterraform\n   python3 scripts\u002Ftf_security_scanner.py .\u002Fterraform --output json\n   ```\n\n---\n\n## Tooling\n\n### `scripts\u002Ftf_module_analyzer.py`\n\nCLI utility for analyzing Terraform directory structure and module quality.\n\n**Features:**\n- Resource and data source counting\n- Variable and output analysis (missing descriptions, types, validation)\n- Naming convention checks\n- Module composition detection\n- File structure validation\n- JSON and text output\n\n**Usage:**\n```bash\n# Analyze a Terraform directory\npython3 scripts\u002Ftf_module_analyzer.py .\u002Fterraform\n\n# JSON output\npython3 scripts\u002Ftf_module_analyzer.py .\u002Fterraform --output json\n\n# Analyze a specific module\npython3 scripts\u002Ftf_module_analyzer.py .\u002Fmodules\u002Fvpc\n```\n\n### `scripts\u002Ftf_security_scanner.py`\n\nCLI utility for scanning `.tf` files for common security issues.\n\n**Features:**\n- Hardcoded secret detection (AWS keys, passwords, tokens)\n- Overly permissive IAM policy detection\n- Open security group detection (0.0.0.0\u002F0 on sensitive ports)\n- Missing encryption checks (S3, RDS, EBS)\n- Public access detection (S3, RDS, EC2)\n- Sensitive variable audit\n- JSON and text output\n\n**Usage:**\n```bash\n# Scan a Terraform directory\npython3 scripts\u002Ftf_security_scanner.py .\u002Fterraform\n\n# JSON output\npython3 scripts\u002Ftf_security_scanner.py .\u002Fterraform --output json\n\n# Strict mode (elevate warnings)\npython3 scripts\u002Ftf_security_scanner.py .\u002Fterraform --strict\n```\n\n---\n\n## Module Design Patterns\n\n### Pattern 1: Flat Module (Small\u002FMedium Projects)\n\n```\ninfrastructure\u002F\n├── main.tf          # All resources\n├── variables.tf     # All inputs\n├── outputs.tf       # All outputs\n├── versions.tf      # Provider requirements\n├── terraform.tfvars # Environment values (not committed)\n└── backend.tf       # Remote state configuration\n```\n\nBest for: Single application, \u003C 20 resources, one team owns everything.\n\n### Pattern 2: Nested Modules (Medium\u002FLarge Projects)\n\n```\ninfrastructure\u002F\n├── environments\u002F\n│   ├── dev\u002F\n│   │   ├── main.tf          # Calls modules with dev params\n│   │   ├── backend.tf       # Dev state backend\n│   │   └── terraform.tfvars\n│   ├── staging\u002F\n│   │   └── ...\n│   └── prod\u002F\n│       └── ...\n├── modules\u002F\n│   ├── networking\u002F\n│   │   ├── main.tf\n│   │   ├── variables.tf\n│   │   └── outputs.tf\n│   ├── compute\u002F\n│   │   └── ...\n│   └── database\u002F\n│       └── ...\n└── versions.tf\n```\n\nBest for: Multiple environments, shared infrastructure patterns, team collaboration.\n\n### Pattern 3: Mono-Repo with Terragrunt\n\n```\ninfrastructure\u002F\n├── terragrunt.hcl           # Root config\n├── modules\u002F                  # Reusable modules\n│   ├── vpc\u002F\n│   ├── eks\u002F\n│   └── rds\u002F\n├── dev\u002F\n│   ├── terragrunt.hcl       # Dev overrides\n│   ├── vpc\u002F\n│   │   └── terragrunt.hcl   # Module invocation\n│   └── eks\u002F\n│       └── terragrunt.hcl\n└── prod\u002F\n    ├── terragrunt.hcl\n    └── ...\n```\n\nBest for: Large-scale, many environments, DRY configuration, team-level isolation.\n\n---\n\n## Provider Configuration Patterns\n\n### Version Pinning\n```hcl\nterraform {\n  required_version = \">= 1.5.0\"\n\n  required_providers {\n    aws = {\n      source  = \"hashicorp\u002Faws\"\n      version = \"~> 5.0\"    # Allow 5.x, block 6.0\n    }\n    random = {\n      source  = \"hashicorp\u002Frandom\"\n      version = \"~> 3.5\"\n    }\n  }\n}\n```\n\n### Multi-Region with Aliases\n```hcl\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n\nprovider \"aws\" {\n  alias  = \"west\"\n  region = \"us-west-2\"\n}\n\nresource \"aws_s3_bucket\" \"primary\" {\n  bucket = \"my-app-primary\"\n}\n\nresource \"aws_s3_bucket\" \"replica\" {\n  provider = aws.west\n  bucket   = \"my-app-replica\"\n}\n```\n\n### Multi-Account with Assume Role\n```hcl\nprovider \"aws\" {\n  alias  = \"production\"\n  region = \"us-east-1\"\n\n  assume_role {\n    role_arn = \"arn:aws:iam::PROD_ACCOUNT_ID:role\u002FTerraformRole\"\n  }\n}\n```\n\n---\n\n## State Management Decision Tree\n\n```\nSingle developer, small project?\n├── Yes → Local state (but migrate to remote ASAP)\n└── No\n    ├── Using Terraform Cloud\u002FEnterprise?\n    │   └── Yes → TF Cloud native backend (built-in locking, encryption, RBAC)\n    └── No\n        ├── AWS?\n        │   └── S3 + DynamoDB (encryption, locking, versioning)\n        ├── GCP?\n        │   └── GCS bucket (native locking, encryption)\n        ├── Azure?\n        │   └── Azure Blob Storage (native locking, encryption)\n        └── Other?\n            └── Consul or PostgreSQL backend\n\nEnvironment isolation strategy:\n├── Separate state files per environment (recommended)\n│   ├── Option A: Separate directories (dev\u002F, staging\u002F, prod\u002F)\n│   └── Option B: Terraform workspaces (simpler but less isolation)\n└── Single state file for all environments (never do this)\n```\n\n---\n\n## CI\u002FCD Integration Patterns\n\n### GitHub Actions Plan\u002FApply\n\n```yaml\n# .github\u002Fworkflows\u002Fterraform.yml\nname: Terraform\non:\n  pull_request:\n    paths: ['terraform\u002F**']\n  push:\n    branches: [main]\n    paths: ['terraform\u002F**']\n\njobs:\n  plan:\n    runs-on: ubuntu-latest\n    if: github.event_name == 'pull_request'\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: hashicorp\u002Fsetup-terraform@v3\n      - run: terraform init\n      - run: terraform validate\n      - run: terraform plan -out=tfplan\n      - run: terraform show -json tfplan > plan.json\n      # Post plan as PR comment\n\n  apply:\n    runs-on: ubuntu-latest\n    if: github.ref == 'refs\u002Fheads\u002Fmain' && github.event_name == 'push'\n    environment: production\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: hashicorp\u002Fsetup-terraform@v3\n      - run: terraform init\n      - run: terraform apply -auto-approve\n```\n\n### Drift Detection\n\n```yaml\n# Run on schedule to detect drift\nname: Drift Detection\non:\n  schedule:\n    - cron: '0 6 * * 1-5'  # Weekdays at 6 AM\n\njobs:\n  detect:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: hashicorp\u002Fsetup-terraform@v3\n      - run: terraform init\n      - run: |\n          terraform plan -detailed-exitcode -out=drift.tfplan 2>&1 | tee drift.log\n          EXIT_CODE=$?\n          if [ $EXIT_CODE -eq 2 ]; then\n            echo \"DRIFT DETECTED — review drift.log\"\n            # Send alert (Slack, PagerDuty, etc.)\n          fi\n```\n\n---\n\n## Proactive Triggers\n\nFlag these without being asked:\n\n- **No remote backend configured** → Migrate to S3\u002FGCS\u002FAzure Blob with locking and encryption.\n- **Provider without version constraint** → Add `version = \"~> X.0\"` to prevent breaking upgrades.\n- **Hardcoded secrets in .tf files** → Use variables with `sensitive = true`, or integrate Vault\u002FSSM.\n- **IAM policy with `\"Action\": \"*\"`** → Scope to specific actions. No wildcard actions in production.\n- **Security group open to 0.0.0.0\u002F0 on SSH\u002FRDP** → Restrict to bastion CIDR or use SSM Session Manager.\n- **No state locking** → Enable DynamoDB table for S3 backend, or use TF Cloud.\n- **Resources without tags** → Add default_tags in provider block. Tags are mandatory for cost tracking.\n- **Missing `prevent_destroy` on databases\u002Fstorage** → Add lifecycle block to prevent accidental deletion.\n\n---\n\n## Multi-Cloud Provider Configuration\n\nWhen a single root module must provision across AWS, Azure, and GCP simultaneously.\n\n### Provider Aliasing Pattern\n\n```hcl\nterraform {\n  required_providers {\n    aws = {\n      source  = \"hashicorp\u002Faws\"\n      version = \"~> 5.0\"\n    }\n    azurerm = {\n      source  = \"hashicorp\u002Fazurerm\"\n      version = \"~> 3.0\"\n    }\n    google = {\n      source  = \"hashicorp\u002Fgoogle\"\n      version = \"~> 5.0\"\n    }\n  }\n}\n\nprovider \"aws\" {\n  region = var.aws_region\n}\n\nprovider \"azurerm\" {\n  features {}\n  subscription_id = var.azure_subscription_id\n}\n\nprovider \"google\" {\n  project = var.gcp_project_id\n  region  = var.gcp_region\n}\n```\n\n### Shared Variables Across Providers\n\n```hcl\nvariable \"environment\" {\n  description = \"Environment name used across all providers\"\n  type        = string\n  validation {\n    condition     = contains([\"dev\", \"staging\", \"prod\"], var.environment)\n    error_message = \"Must be dev, staging, or prod.\"\n  }\n}\n\nlocals {\n  common_tags = {\n    environment = var.environment\n    managed_by  = \"terraform\"\n    project     = var.project_name\n  }\n}\n```\n\n### When to Use Multi-Cloud\n\n- **Yes**: Regulatory requirements mandate data residency across providers, or the org has existing workloads on multiple clouds.\n- **No**: \"Avoiding vendor lock-in\" alone is not sufficient justification. Multi-cloud doubles operational complexity. Prefer single-cloud unless there is a concrete business requirement.\n\n---\n\n## OpenTofu Compatibility\n\nOpenTofu is an open-source fork of Terraform maintained by the Linux Foundation under the MPL 2.0 license.\n\n### Migration from Terraform to OpenTofu\n\n```bash\n# 1. Install OpenTofu\nbrew install opentofu        # macOS\nsnap install --classic tofu  # Linux\n\n# 2. Replace the binary — state files are compatible\ntofu init                    # Re-initializes with OpenTofu\ntofu plan                    # Identical plan output\ntofu apply                   # Same apply workflow\n```\n\n### License Considerations\n\n| | Terraform (1.6+) | OpenTofu |\n|---|---|---|\n| **License** | BSL 1.1 (source-available) | MPL 2.0 (open-source) |\n| **Commercial use** | Restricted for competing products | Unrestricted |\n| **Community governance** | HashiCorp | Linux Foundation |\n\n### Feature Parity\n\nOpenTofu tracks Terraform 1.6.x features. Key additions unique to OpenTofu:\n- Client-side state encryption (`tofu init -encryption`)\n- Early variable\u002Flocals evaluation\n- Provider-defined functions\n\n### When to Choose OpenTofu\n\n- You need a fully open-source license for your supply chain.\n- You want client-side state encryption without Terraform Cloud.\n- Otherwise, either tool works — the HCL syntax and provider ecosystem are identical.\n\n---\n\n## Infracost Integration\n\nInfracost estimates cloud costs from Terraform code before resources are provisioned.\n\n### PR Workflow\n\n```bash\n# Show cost breakdown for current code\ninfracost breakdown --path .\n\n# Compare cost difference between current branch and main\ninfracost diff --path . --compare-to infracost-base.json\n```\n\n### GitHub Actions Cost Comment\n\n```yaml\n# .github\u002Fworkflows\u002Finfracost.yml\nname: Infracost\non: [pull_request]\n\njobs:\n  cost:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: infracost\u002Factions\u002Fsetup@v3\n        with:\n          api-key: ${{ secrets.INFRACOST_API_KEY }}\n      - run: infracost breakdown --path .\u002Fterraform --format json --out-file \u002Ftmp\u002Finfracost.json\n      - run: infracost comment github --path \u002Ftmp\u002Finfracost.json --repo $GITHUB_REPOSITORY --pull-request ${{ github.event.pull_request.number }} --github-token ${{ secrets.GITHUB_TOKEN }} --behavior update\n```\n\n### Budget Thresholds and Cost Policy\n\n```yaml\n# infracost.yml — policy file\nversion: 0.1\npolicies:\n  - path: \"*\"\n    max_monthly_cost: \"5000\"    # Fail PR if estimated cost exceeds $5,000\u002Fmonth\n    max_cost_increase: \"500\"    # Fail PR if cost increase exceeds $500\u002Fmonth\n```\n\n---\n\n## Import Existing Infrastructure\n\nBring manually-created resources under Terraform management.\n\n### terraform import Workflow\n\n```bash\n# 1. Write the resource block first (empty body is fine)\n# main.tf:\n# resource \"aws_s3_bucket\" \"legacy\" {}\n\n# 2. Import the resource into state\nterraform import aws_s3_bucket.legacy my-existing-bucket-name\n\n# 3. Run plan to see attribute diff\nterraform plan\n\n# 4. Fill in the resource block until plan shows no changes\n```\n\n### Bulk Import with Config Generation (Terraform 1.5+)\n\n```bash\n# Generate HCL for imported resources\nterraform plan -generate-config-out=generated.tf\n\n# Review generated.tf, then move resources into proper files\n```\n\n### Common Pitfalls\n\n- **Resource drift after import**: The imported resource may have attributes Terraform does not manage. Run `terraform plan` immediately and resolve every diff.\n- **State manipulation**: Use `terraform state mv` to rename or reorganize. Use `terraform state rm` to remove without destroying. Always back up state before manipulation: `terraform state pull > backup.tfstate`.\n- **Sensitive defaults**: Imported resources may expose secrets in state. Restrict state access and enable encryption.\n\n---\n\n## Terragrunt Patterns\n\nTerragrunt is a thin wrapper around Terraform that provides DRY configuration for multi-environment setups.\n\n### Root terragrunt.hcl (Shared Config)\n\n```hcl\n# terragrunt.hcl (root)\nremote_state {\n  backend = \"s3\"\n  generate = {\n    path      = \"backend.tf\"\n    if_exists = \"overwrite_terragrunt\"\n  }\n  config = {\n    bucket         = \"my-org-terraform-state\"\n    key            = \"${path_relative_to_include()}\u002Fterraform.tfstate\"\n    region         = \"us-east-1\"\n    encrypt        = true\n    dynamodb_table = \"terraform-locks\"\n  }\n}\n```\n\n### Child terragrunt.hcl (Environment Override)\n\n```hcl\n# prod\u002Fvpc\u002Fterragrunt.hcl\ninclude \"root\" {\n  path = find_in_parent_folders()\n}\n\nterraform {\n  source = \"..\u002F..\u002Fmodules\u002Fvpc\"\n}\n\ninputs = {\n  environment = \"prod\"\n  cidr_block  = \"10.0.0.0\u002F16\"\n}\n```\n\n### Dependencies Between Modules\n\n```hcl\n# prod\u002Feks\u002Fterragrunt.hcl\ndependency \"vpc\" {\n  config_path = \"..\u002Fvpc\"\n}\n\ninputs = {\n  vpc_id     = dependency.vpc.outputs.vpc_id\n  subnet_ids = dependency.vpc.outputs.private_subnet_ids\n}\n```\n\n### When Terragrunt Adds Value\n\n- **Yes**: 3+ environments with identical module structure, shared backend config, or cross-module dependencies.\n- **No**: Single environment, small team, or simple directory-based isolation already works. Terragrunt adds a learning curve and another binary to manage.\n\n---\n\n## Installation\n\n### One-liner (any tool)\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Falirezarezvani\u002Fclaude-skills.git\ncp -r claude-skills\u002Fengineering\u002Fterraform-patterns ~\u002F.claude\u002Fskills\u002F\n```\n\n### Multi-tool install\n```bash\n.\u002Fscripts\u002Fconvert.sh --skill terraform-patterns --tool codex|gemini|cursor|windsurf|openclaw\n```\n\n### OpenClaw\n```bash\nclawhub install terraform-patterns\n```\n\n---\n\n## Related Skills\n\n- **senior-devops** — Broader DevOps scope (CI\u002FCD, monitoring, containerization). Complementary — use terraform-patterns for IaC-specific work, senior-devops for pipeline and infrastructure operations.\n- **aws-solution-architect** — AWS architecture design. Complementary — terraform-patterns implements the infrastructure, aws-solution-architect designs it.\n- **senior-security** — Application security. Complementary — terraform-patterns covers infrastructure security posture, senior-security covers application-level threats.\n- **ci-cd-pipeline-builder** — Pipeline construction. Complementary — terraform-patterns defines infrastructure, ci-cd-pipeline-builder automates deployment.\n",{"name":5,"license":14,"metadata":23,"description":7},{"author":24,"updated":25,"version":26,"category":27},"Alireza Rezvani",1773532800000,"1.0.0","engineering","main","f37de8f681f0c0ca0e0ebab6e5fddf764ca7553d","skills\u002Fterraform-patterns",1,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one","https:\u002F\u002Fagisota.github.io\u002Fold-one\u002F","https:\u002F\u002Fgithub.com\u002Fagisota","pzd.world","2026-07-04 22:32:06",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add agisota\u002Fold-one --skill terraform-patterns",{"tool":43,"command":44},"bunx","bunx skills add agisota\u002Fold-one --skill terraform-patterns",{"tool":46,"command":47},"pnpm","pnpm dlx skills add agisota\u002Fold-one --skill terraform-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fterraform-patterns\u002FSKILL.md",true,[],[52,59,66,75,82,89],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M75KRGZWQWE9JDBS6RX42NWV","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M75KRCZHKE0ZYAQFFYHS0YNP","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzeroize-audit\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":70,"licenseFileUrl":71,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"01M75KR94KYQ30DTE1P9WNDAE0","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M75KR3H13YJ9QHMD49818FA1","yara-rule-authoring","Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyara-rule-authoring\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M75KQMPY8A4Y8XTDD2DT0M9T","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":18},"01M75KQHNZ0ANZNJGZY6M8MDAK","x-api","X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]