Skip to content

Commit dc203ee

Browse files
Add terramate skills (#51)
<!-- CURSOR_SUMMARY --> > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is generating a summary for commit 0d1b456. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
2 parents f55e364 + 0d1b456 commit dc203ee

20 files changed

Lines changed: 3541 additions & 0 deletions

.agents/skills/terramate-best-practices/AGENTS.md

Lines changed: 1746 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
name: terramate-best-practices
3+
description: Terramate CLI, Cloud, and Catalyst best practices and usage guides. This skill should be used when working with Terramate stacks, orchestration, code generation, Cloud integration, or Catalyst components and bundles.
4+
license: MIT
5+
metadata:
6+
author: terramate
7+
version: "1.0.0"
8+
---
9+
10+
# Terramate Best Practices
11+
12+
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.
13+
14+
## When to Apply
15+
16+
Reference these guidelines when:
17+
- Creating and organizing Terramate stacks
18+
- Orchestrating commands across multiple stacks
19+
- Using code generation to keep configurations DRY
20+
- Integrating with Terramate Cloud for observability
21+
- Creating Catalyst components and bundles
22+
- Setting up CI/CD workflows with Terramate
23+
- Managing stack dependencies and execution order
24+
25+
## Rule Categories by Priority
26+
27+
| Priority | Category | Impact | Prefix |
28+
|----------|----------|--------|--------|
29+
| 1 | CLI Fundamentals | CRITICAL | `cli-` |
30+
| 2 | CLI Orchestration | HIGH | `cli-orchestration-` |
31+
| 3 | CLI Code Generation | HIGH | `cli-codegen-` |
32+
| 4 | CLI Configuration | MEDIUM-HIGH | `cli-config-` |
33+
| 5 | Terramate Cloud | MEDIUM-HIGH | `cloud-` |
34+
| 6 | Terramate Catalyst | MEDIUM | `catalyst-` |
35+
| 7 | CI/CD Integration | MEDIUM | `cicd-` |
36+
| 8 | Advanced Patterns | LOW-MEDIUM | `advanced-` |
37+
38+
## Quick Reference
39+
40+
### 1. CLI Fundamentals (CRITICAL)
41+
42+
- `cli-stack-structure` - Organize stacks with clear directory structure
43+
- `cli-stack-config` - Configure stacks with proper stack blocks
44+
- `cli-stack-metadata` - Use metadata for stack identification and filtering
45+
46+
### 2. CLI Orchestration (HIGH)
47+
48+
- `cli-orchestration-run` - Run commands across stacks efficiently
49+
- `cli-orchestration-change-detection` - Use change detection to limit execution scope
50+
- `cli-orchestration-parallel` - Leverage parallel execution for independent stacks
51+
- `cli-orchestration-dependencies` - Manage stack dependencies and execution order
52+
53+
### 3. CLI Code Generation (HIGH)
54+
55+
- `cli-codegen-hcl` - Use generate_hcl for DRY Terraform code
56+
- `cli-codegen-file` - Use generate_file for file generation patterns
57+
- `cli-codegen-provider` - Generate provider configurations dynamically
58+
59+
### 4. CLI Configuration (MEDIUM-HIGH)
60+
61+
- `cli-config-globals` - Use globals for shared configuration across stacks
62+
- `cli-config-lets` - Use lets for stack-local computed values
63+
- `cli-config-metadata` - Leverage metadata for stack information
64+
65+
### 5. Terramate Cloud (MEDIUM-HIGH)
66+
67+
- `cloud-integration` - Set up Cloud connection and authentication
68+
- `cloud-drift-management` - Configure drift detection and reconciliation
69+
- `cloud-observability` - Use Cloud dashboard for stack visibility
70+
71+
### 6. Terramate Catalyst (MEDIUM)
72+
73+
- `catalyst-components` - Create reusable component blueprints
74+
- `catalyst-bundles` - Define bundles for component composition
75+
- `catalyst-instantiation` - Instantiate bundles correctly
76+
77+
### 7. CI/CD Integration (MEDIUM)
78+
79+
- `cicd-github-actions` - Set up GitHub Actions workflows
80+
- `cicd-preview-workflows` - Create preview workflows for PRs
81+
- `cicd-deployment-workflows` - Configure deployment automation
82+
83+
### 8. Advanced Patterns (LOW-MEDIUM)
84+
85+
- `advanced-workflows` - Create complex multi-step workflows
86+
- `advanced-codegen-patterns` - Advanced code generation techniques
87+
88+
## How to Use
89+
90+
Read individual rule files for detailed explanations and code examples:
91+
92+
```
93+
rules/cli-stack-structure.md
94+
rules/cli-orchestration-run.md
95+
rules/cli-codegen-hcl.md
96+
rules/cloud-integration.md
97+
rules/catalyst-components.md
98+
```
99+
100+
Each rule file contains:
101+
- Brief explanation of why it matters
102+
- Incorrect/anti-pattern example with explanation
103+
- Correct/best practice example with explanation
104+
- Additional context and references
105+
106+
## Full Compiled Document
107+
108+
For the complete guide with all rules expanded: `AGENTS.md`
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# catalyst-bundles
2+
3+
**Priority:** MEDIUM
4+
**Category:** Terramate Catalyst
5+
6+
## Why It Matters
7+
8+
Bundles compose multiple components into ready-to-use, deployable units. They abstract infrastructure complexity and enable developers to provision complete solutions without deep infrastructure knowledge.
9+
10+
## Incorrect
11+
12+
```hcl
13+
# Developers manually compose components
14+
# No standardization
15+
# Missing dependencies
16+
# Inconsistent patterns
17+
18+
# app-team/stack.tm.hcl
19+
tm_bundle "database" {
20+
component = "rds-postgres"
21+
# ...
22+
}
23+
24+
tm_bundle "cache" {
25+
component = "redis"
26+
# ...
27+
}
28+
29+
tm_bundle "storage" {
30+
component = "s3-bucket"
31+
# ...
32+
}
33+
34+
# Missing: VPC, networking, security groups
35+
# Missing: Component dependencies
36+
# Missing: Consistent configuration
37+
```
38+
39+
**Problem:** Manual composition, missing dependencies, inconsistent patterns, developers need deep infrastructure knowledge.
40+
41+
## Correct
42+
43+
**Bundle definition:**
44+
45+
```hcl
46+
# bundles/web-app/bundle.tm.hcl
47+
bundle {
48+
name = "web-app"
49+
description = "Complete web application infrastructure"
50+
51+
component "networking" {
52+
source = "vpc"
53+
input = {
54+
cidr_block = "10.0.0.0/16"
55+
}
56+
}
57+
58+
component "database" {
59+
source = "rds-postgres"
60+
input = {
61+
instance_class = "db.t3.micro"
62+
allocated_storage = 20
63+
}
64+
65+
depends_on = ["networking"]
66+
}
67+
68+
component "cache" {
69+
source = "redis"
70+
input = {
71+
node_type = "cache.t3.micro"
72+
}
73+
74+
depends_on = ["networking"]
75+
}
76+
77+
component "storage" {
78+
source = "s3-bucket"
79+
input = {
80+
name = "${bundle.name}-storage"
81+
}
82+
}
83+
84+
component "compute" {
85+
source = "ecs-service"
86+
input = {
87+
cluster_name = "${bundle.name}-cluster"
88+
vpc_id = component.networking.output.vpc_id
89+
subnet_ids = component.networking.output.private_subnet_ids
90+
}
91+
92+
depends_on = ["networking", "database", "cache"]
93+
}
94+
}
95+
```
96+
97+
**Bundle instantiation:**
98+
99+
```hcl
100+
# stacks/prod-web-app/stack.tm.hcl
101+
stack {
102+
name = "prod-web-app"
103+
}
104+
105+
# Instantiate bundle
106+
tm_bundle "web-app" {
107+
bundle = "web-app"
108+
109+
input = {
110+
# Bundle-level overrides if needed
111+
}
112+
}
113+
```
114+
115+
**Benefits:**
116+
- Complete solutions in one bundle
117+
- Automatic dependency management
118+
- Consistent patterns across teams
119+
- Abstracted complexity
120+
- Easy to instantiate
121+
- Platform team maintains bundles
122+
123+
## Additional Context
124+
125+
Bundle composition:
126+
- Combines multiple components
127+
- Manages component dependencies
128+
- Provides bundle-level configuration
129+
- Supports component outputs as inputs
130+
131+
Bundle vs Component:
132+
- **Component** - Single infrastructure resource/pattern
133+
- **Bundle** - Multiple components composed together
134+
- Use bundles for complete solutions
135+
- Use components for individual resources
136+
137+
Converting existing Terraform modules to components:
138+
- Run `terramate component create` inside an existing Terraform module directory
139+
- This automatically generates the component structure from your module
140+
- Converts module variables to component inputs
141+
- Converts module outputs to component outputs
142+
- Preserves existing Terraform code
143+
144+
## References
145+
146+
- [Terramate Catalyst Bundles](https://terramate.io/docs/catalyst/concepts/bundles/)
147+
- [Instantiate Your First Bundle](https://terramate.io/docs/catalyst/tutorials/instantiate-your-first-bundle/)
148+
- [Bundle Definition](https://terramate.io/docs/catalyst/reference/bundle-definition/)

0 commit comments

Comments
 (0)