
这是一个Claude代码技能,提供Terragrunt基础设施即代码与OpenTofu/Terraform的最佳实践指导。
概览
这是一个Claude代码技能,提供Terragrunt基础设施即代码与OpenTofu/Terraform的最佳实践指导。 目录和实时仓库应为 。实时仓库通过 Git URL 从目录中消耗单位和堆栈。 - :可复用单元和模板堆栈(独立仓库)- :占用目录的环境特定部署- :具有语义版本控制的独立仓库 - 配置注入的值模式- 参考解析(“../unit”→依赖输出)- 单位互依赖关系与模拟输出 - 条件依赖关系带启用和 skip_outputs - 带可复用模板的 GitLab CI - GitHub Actions 工作流程 - AWS OIDC 认证(假设角色与网页身份)- GCP 工作负载身份联合 - 基于 SSH 的 Git 访问(推荐于 HTTPS) - 提供者缓存(--provider-cache)- 两层缓存架构(本地+网络镜像)- 基准测试工具(Hyperfine、boring-registry)- 显式栈以实现2倍快运行 -...
概述(AI 翻译)
这是一个Claude代码技能,提供Terragrunt基础设施即代码与OpenTofu/Terraform的最佳实践指导。
建筑
重要: 目录仓库和实时仓库应当分开的Git仓库。实时仓库通过Git的URL消耗目录中的单位和堆栈。
选项A:模块分隔仓库
选项B:目录中的模块
权衡取舍:
| 方面 | 选项A(独立模块仓库) | 选项B(目录中的模块) |
|---|---|---|
| 版本管理 | 每个模块独立 | 单一目录版本 |
| CI/CD | 每个模块专用流水线 | 所有模块共用一条流水线 |
| 复杂度 | 更多需要管理的仓库 | 更简单的结构 |
| 球队所有权 | 明确界限 | 共享所有权 |
terragrunt catalog |
发现单位/堆栈 | 也发现模块 |
特色
目录与现场模式
- 基础设施目录:可复用单元和模板堆栈(独立仓库)
- 基础设施上线:占用目录的环境特定部署
- 模块仓库:具有语义版本控制的独立仓库
单位与堆栈模式
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Terragrunt Agent Skill
An agent skill providing best practices guidance for Terragrunt (0.68 to 1.2) infrastructure-as-code with OpenTofu or Terraform. Version differences are covered in version-compatibility.md. It follows the open Agent Skills spec (https://agentskills.io/specification), so it works with any compatible agent (Claude Code, Codex, Cursor, Gemini CLI, …).
Architecture
Important: Catalog and Live repositories should be separate Git repositories. The live repo consumes units and stacks from the catalog via Git URLs.
Option A: Modules in Separate Repos
┌─────────────────────────────────────────────────────────────────────┐
│ SEPARATE REPOSITORIES │
├─────────────────────────┬─────────────────────────┬─────────────────┤
│ Module Repos │ Catalog Repo │ Live Repo │
│ (terraform-aws-*) │ (infrastructure- │ (infrastructure-
│ │ -catalog) │ -live) │
├─────────────────────────┼─────────────────────────┼─────────────────┤
│ • OpenTofu modules │ • units/ (wrappers) │ • root.hcl │
│ • Semantic versioning │ • stacks/ (templates) │ • account.hcl │
│ • Terratest │ • References modules │ • Deployments │
│ • Pre-commit hooks │ via Git URLs │ • Consumes │
│ │ │ catalog │
└─────────────────────────┴─────────────────────────┴─────────────────┘
▲ ▲ │
│ │ │
└─────────────────────────┴────────────────────────┘
Live repo references both via Git URLs
Option B: Modules in Catalog
┌───────────────────────────────────────────────────────────────┐
│ SEPARATE REPOSITORIES │
├─────────────────────────────────┬─────────────────────────────┤
│ Catalog Repo │ Live Repo │
│ (infrastructure--catalog)│ (infrastructure--live)
├─────────────────────────────────┼─────────────────────────────┤
│ • modules/ (OpenTofu modules) │ • root.hcl │
│ • units/ (module wrappers) │ • account.hcl │
│ • stacks/ (unit compositions) │ • Deployments │
│ • Discovered via `tg catalog` │ • Consumes catalog via Git │
│ • Single versioning strategy │ • `tg scaffold` for new │
└─────────────────────────────────┴─────────────────────────────┘
▲ │
└──────────────────────────────┘
Live repo references catalog
Trade-offs:
| Aspect | Option A (Separate Module Repos) | Option B (Modules in Catalog) |
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add jfr992/terragrunt-skill