terramate-best-practices
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTerramate Best Practices
Terramate 最佳实践
Comprehensive guide for Terramate CLI, Cloud, and Catalyst, maintained by Terramate. Contains best practices and usage patterns for stack management, orchestration, code generation, Cloud integration, and Catalyst components/bundles.
由Terramate维护的Terramate CLI、Cloud及Catalyst综合指南,涵盖堆栈管理、编排、代码生成、Cloud集成以及Catalyst组件/包的最佳实践与使用模式。
When to Apply
适用场景
Reference these guidelines when:
- Creating and organizing Terramate stacks
- Orchestrating commands across multiple stacks
- Using code generation to keep configurations DRY
- Integrating with Terramate Cloud for observability
- Creating Catalyst components and bundles
- Setting up CI/CD workflows with Terramate
- Managing stack dependencies and execution order
在以下场景中可参考本指南:
- 创建与组织Terramate堆栈
- 跨多个堆栈编排命令
- 使用代码生成保持配置DRY(Don't Repeat Yourself)
- 集成Terramate Cloud以实现可观测性
- 创建Catalyst组件与包
- 基于Terramate搭建CI/CD工作流
- 管理堆栈依赖与执行顺序
Rule Categories by Priority
按优先级划分的规则类别
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | CLI Fundamentals | CRITICAL | |
| 2 | CLI Orchestration | HIGH | |
| 3 | CLI Code Generation | HIGH | |
| 4 | CLI Configuration | MEDIUM-HIGH | |
| 5 | Terramate Cloud | MEDIUM-HIGH | |
| 6 | Terramate Catalyst | MEDIUM | |
| 7 | CI/CD Integration | MEDIUM | |
| 8 | Advanced Patterns | LOW-MEDIUM | |
| 优先级 | 类别 | 影响程度 | 前缀 |
|---|---|---|---|
| 1 | CLI基础 | 关键 | |
| 2 | CLI编排 | 高 | |
| 3 | CLI代码生成 | 高 | |
| 4 | CLI配置 | 中高 | |
| 5 | Terramate Cloud | 中高 | |
| 6 | Terramate Catalyst | 中 | |
| 7 | CI/CD集成 | 中 | |
| 8 | 高级模式 | 中低 | |
Quick Reference
快速参考
1. CLI Fundamentals (CRITICAL)
1. CLI基础(关键)
- - Organize stacks with clear directory structure
cli-stack-structure - - Configure stacks with proper stack blocks
cli-stack-config - - Use metadata for stack identification and filtering
cli-stack-metadata
- - 采用清晰的目录结构组织堆栈
cli-stack-structure - - 使用正确的堆栈块配置堆栈
cli-stack-config - - 利用元数据进行堆栈识别与过滤
cli-stack-metadata
2. CLI Orchestration (HIGH)
2. CLI编排(高)
- - Run commands across stacks efficiently
cli-orchestration-run - - Use change detection to limit execution scope
cli-orchestration-change-detection - - Leverage parallel execution for independent stacks
cli-orchestration-parallel - - Manage stack dependencies and execution order
cli-orchestration-dependencies
- - 高效跨堆栈运行命令
cli-orchestration-run - - 使用变更检测限制执行范围
cli-orchestration-change-detection - - 对独立堆栈采用并行执行
cli-orchestration-parallel - - 管理堆栈依赖与执行顺序
cli-orchestration-dependencies
3. CLI Code Generation (HIGH)
3. CLI代码生成(高)
- - Use generate_hcl for DRY Terraform code
cli-codegen-hcl - - Use generate_file for file generation patterns
cli-codegen-file - - Generate provider configurations dynamically
cli-codegen-provider
- - 使用generate_hcl实现DRY的Terraform代码
cli-codegen-hcl - - 使用generate_file实现文件生成模式
cli-codegen-file - - 动态生成提供商配置
cli-codegen-provider
4. CLI Configuration (MEDIUM-HIGH)
4. CLI配置(中高)
- - Use globals for shared configuration across stacks
cli-config-globals - - Use lets for stack-local computed values
cli-config-lets - - Leverage metadata for stack information
cli-config-metadata
- - 使用全局配置实现跨堆栈共享配置
cli-config-globals - - 使用lets定义堆栈本地计算值
cli-config-lets - - 利用元数据获取堆栈信息
cli-config-metadata
5. Terramate Cloud (MEDIUM-HIGH)
5. Terramate Cloud(中高)
- - Set up Cloud connection and authentication
cloud-integration - - Configure drift detection and reconciliation
cloud-drift-management - - Use Cloud dashboard for stack visibility
cloud-observability
- - 搭建Cloud连接与认证
cloud-integration - - 配置漂移检测与协调
cloud-drift-management - - 使用Cloud仪表盘实现堆栈可见性
cloud-observability
6. Terramate Catalyst (MEDIUM)
6. Terramate Catalyst(中)
- - Create reusable component blueprints
catalyst-components - - Define bundles for component composition
catalyst-bundles - - Instantiate bundles correctly
catalyst-instantiation
- - 创建可复用的组件蓝图
catalyst-components - - 定义用于组件组合的包
catalyst-bundles - - 正确实例化包
catalyst-instantiation
7. CI/CD Integration (MEDIUM)
7. CI/CD集成(中)
- - Set up GitHub Actions workflows
cicd-github-actions - - Create preview workflows for PRs
cicd-preview-workflows - - Configure deployment automation
cicd-deployment-workflows
- - 搭建GitHub Actions工作流
cicd-github-actions - - 为PR创建预览工作流
cicd-preview-workflows - - 配置部署自动化
cicd-deployment-workflows
8. Advanced Patterns (LOW-MEDIUM)
8. 高级模式(中低)
- - Create complex multi-step workflows
advanced-workflows - - Advanced code generation techniques
advanced-codegen-patterns
- - 创建复杂的多步骤工作流
advanced-workflows - - 高级代码生成技术
advanced-codegen-patterns
How to Use
使用方法
Read individual rule files for detailed explanations and code examples:
rules/cli-stack-structure.md
rules/cli-orchestration-run.md
rules/cli-codegen-hcl.md
rules/cloud-integration.md
rules/catalyst-components.mdEach rule file contains:
- Brief explanation of why it matters
- Incorrect/anti-pattern example with explanation
- Correct/best practice example with explanation
- Additional context and references
阅读单个规则文件获取详细说明与代码示例:
rules/cli-stack-structure.md
rules/cli-orchestration-run.md
rules/cli-codegen-hcl.md
rules/cloud-integration.md
rules/catalyst-components.md每个规则文件包含:
- 简要说明该规则的重要性
- 错误/反模式示例及解释
- 正确/最佳实践示例及解释
- 额外背景信息与参考资料
Full Compiled Document
完整编译文档
For the complete guide with all rules expanded:
AGENTS.md如需查看包含所有扩展规则的完整指南,请参考:
AGENTS.md