用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill terraform命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
基于 SOC 职业分类
正在显示 SKILL.md
| name | terraform |
| description | > Use when this capability is needed. |
Comprehensive Terraform guidance covering modules, testing, CI/CD, and production patterns. Combines best practices from terraform-best-practices.com and Cloud Foundation Fabric.
These principles guide all Terraform work:
Every Terraform root module must have:
| File | Purpose |
|---|---|
versions.tf | Provider versions and configuration |
backend.tf | Remote state (even if empty initially) |
locals.tf | Centralized local values |
variables.tf | Input variables (when needed) |
Organize by domain/workload, not by resource type:
# GOOD - Files by domain:
├── networking.tf # VPC, subnets, routes, NAT
├── webserver.tf # MIG, template, LB, service account
├── salesforce-etl.tf # SA, secrets, Cloud Function, BigQuery
└── database.tf # Cloud SQL, IAM, backups
# BAD - Files by resource type:
├── iam.tf # All IAM mixed together
├── compute.tf # All compute mixed together
└── storage.tf # All storage mixed together
| Type | Pattern | Example |
|---|---|---|
| Resources | Descriptive, contextual | web_server, application_logs |
| Singletons | Use this | google_compute_network.this |
| Variables | Context-specific | vpc_cidr_block, database_instance_class |
| Outputs | {name}_{type}_{attribute} | firewall_rule_id, subnet_ids |
| Type | Scope | Example |
|---|---|---|
| Resource Module | Single logical group | VPC + subnets |
| Infrastructure Module | Collection of resources | Complete networking stack |
| Composition | Environment-specific | Production environment |
| Repository | Owns its resources | App repo = app resources only |
Do resources need meaningful identifiers?
│
├─ YES → for_each (with set or map)
│
└─ NO → Can items change position?
├─ YES → for_each (prevents cascade)
└─ NO → count (simpler)
See code-patterns.md for migration patterns and detailed examples.
What do you need to test?
│
├─ Syntax/format? → terraform validate + fmt
├─ Security? → trivy + checkov
├─ Simple logic (1.6+)? → Native tests
└─ Complex integration? → Terratest
See testing-frameworks.md for implementation details.
Always use OIDC. Never use service account keys.
| Method | Security | Use Case |
|---|---|---|
| OIDC | ✅ No long-lived credentials | CI/CD (GitHub Actions) |
| ADC | ✅ User credentials | Local development |
| Impersonation | ✅ Service account delegation | Automation |
| Keys | ❌ Long-lived risk | Never use |
See security-compliance.md for OIDC setup and security patterns.
| Feature | Version | When to Use |
|---|---|---|
try() | 0.13+ | Safe fallbacks (always use) |
optional() | 1.3+ | Optional object attributes |
moved blocks | 1.1+ | Refactor without recreation |
| Native tests | 1.6+ | Unit testing in HCL |
| Mock providers | 1.7+ | Cost-free testing |
| Write-only args | 1.11+ | Secrets (never in state) |
# Static analysis (always free)
terraform fmt -recursive -check
terraform validate
tflint
trivy config .
checkov -d .
# Testing (1.6+)
terraform test
# Plan and apply
terraform plan -out=tfplan
terraform apply -auto-approve tfplan
# State management
terraform state list
terraform show
See quick-reference.md for full cheat sheet.
See security-compliance.md for detailed patterns.
versions.tf with provider constraintsbackend.tf for remote statevariables.tf with descriptions and validationoutputs.tf with descriptionsexamples/ directory (simple and complete)See module-patterns.md for details.
validate → plan → apply
| Decision | Recommendation |
|---|---|
| Authentication | OIDC (never keys) |
| Apply trigger | Push for dev/staging, approval for prod |
| Workspaces | Separate files per environment |
| Security scan | Trivy + Checkov in CI |
See ci-cd-workflows.md for templates.
When to use: Writing or refactoring Terraform code
Covers:
When to use: Need quick lookup or troubleshooting
Covers:
When to use: Creating or restructuring modules
Covers:
When to use: Setting up or choosing testing approach
Covers:
When to use: Setting up CI/CD pipelines
Covers:
When to use: Security review or compliance setup
Covers:
When to use: Building scalable, self-service infrastructure
Covers:
Based on:
Source: benjaminwestern/google-engineer-skills — distributed by TomeVault.