@c0x12c/ai-toolkit 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +16 -0
- package/.claude-plugin/plugin.json +12 -0
- package/README.md +439 -0
- package/VERSION +1 -0
- package/agents/design-critic.md +127 -0
- package/agents/idea-killer.md +72 -0
- package/agents/infrastructure-expert.md +49 -0
- package/agents/micronaut-backend-expert.md +45 -0
- package/agents/phase-reviewer.md +150 -0
- package/agents/research-planner.md +70 -0
- package/agents/solution-architect-cto.md +49 -0
- package/agents/sre-architect.md +49 -0
- package/agents/team-coordinator.md +111 -0
- package/bin/cli.js +780 -0
- package/claude-md/00-header.md +39 -0
- package/claude-md/01-core.md +105 -0
- package/claude-md/05-database.md +20 -0
- package/claude-md/11-backend-micronaut.md +19 -0
- package/claude-md/20-frontend-react.md +44 -0
- package/claude-md/25-ux-design.md +56 -0
- package/claude-md/30-infrastructure.md +24 -0
- package/claude-md/30-project-mgmt.md +119 -0
- package/claude-md/40-product.md +39 -0
- package/claude-md/50-ops.md +34 -0
- package/claude-md/60-research.md +27 -0
- package/claude-md/90-footer.md +21 -0
- package/commands/spartan/brainstorm.md +134 -0
- package/commands/spartan/brownfield.md +157 -0
- package/commands/spartan/build.md +435 -0
- package/commands/spartan/careful.md +94 -0
- package/commands/spartan/commit-message.md +112 -0
- package/commands/spartan/content.md +17 -0
- package/commands/spartan/context-save.md +161 -0
- package/commands/spartan/contribute.md +140 -0
- package/commands/spartan/daily.md +42 -0
- package/commands/spartan/debug.md +308 -0
- package/commands/spartan/deep-dive.md +55 -0
- package/commands/spartan/deploy.md +207 -0
- package/commands/spartan/e2e.md +264 -0
- package/commands/spartan/env-setup.md +166 -0
- package/commands/spartan/epic.md +199 -0
- package/commands/spartan/fe-review.md +181 -0
- package/commands/spartan/figma-to-code.md +260 -0
- package/commands/spartan/forensics.md +46 -0
- package/commands/spartan/freeze.md +84 -0
- package/commands/spartan/fundraise.md +53 -0
- package/commands/spartan/gate-review.md +229 -0
- package/commands/spartan/gsd-upgrade.md +376 -0
- package/commands/spartan/guard.md +42 -0
- package/commands/spartan/init-project.md +178 -0
- package/commands/spartan/init-rules.md +298 -0
- package/commands/spartan/interview.md +154 -0
- package/commands/spartan/kickoff.md +73 -0
- package/commands/spartan/kotlin-service.md +109 -0
- package/commands/spartan/lean-canvas.md +222 -0
- package/commands/spartan/lint-rules.md +122 -0
- package/commands/spartan/map-codebase.md +124 -0
- package/commands/spartan/migration.md +82 -0
- package/commands/spartan/next-app.md +317 -0
- package/commands/spartan/next-feature.md +212 -0
- package/commands/spartan/onboard.md +326 -0
- package/commands/spartan/outreach.md +16 -0
- package/commands/spartan/phase.md +142 -0
- package/commands/spartan/pitch.md +18 -0
- package/commands/spartan/plan.md +210 -0
- package/commands/spartan/pr-ready.md +202 -0
- package/commands/spartan/project.md +106 -0
- package/commands/spartan/qa.md +222 -0
- package/commands/spartan/research.md +254 -0
- package/commands/spartan/review.md +132 -0
- package/commands/spartan/scan-rules.md +173 -0
- package/commands/spartan/sessions.md +143 -0
- package/commands/spartan/spec.md +131 -0
- package/commands/spartan/startup.md +257 -0
- package/commands/spartan/team.md +570 -0
- package/commands/spartan/teardown.md +161 -0
- package/commands/spartan/testcontainer.md +97 -0
- package/commands/spartan/tf-cost.md +123 -0
- package/commands/spartan/tf-deploy.md +116 -0
- package/commands/spartan/tf-drift.md +100 -0
- package/commands/spartan/tf-import.md +107 -0
- package/commands/spartan/tf-module.md +121 -0
- package/commands/spartan/tf-plan.md +100 -0
- package/commands/spartan/tf-review.md +106 -0
- package/commands/spartan/tf-scaffold.md +109 -0
- package/commands/spartan/tf-security.md +147 -0
- package/commands/spartan/think.md +221 -0
- package/commands/spartan/unfreeze.md +13 -0
- package/commands/spartan/update.md +134 -0
- package/commands/spartan/ux.md +1233 -0
- package/commands/spartan/validate.md +193 -0
- package/commands/spartan/web-to-prd.md +706 -0
- package/commands/spartan/workstreams.md +109 -0
- package/commands/spartan/write.md +16 -0
- package/commands/spartan.md +386 -0
- package/frameworks/00-framework-comparison-guide.md +317 -0
- package/frameworks/01-lean-canvas.md +196 -0
- package/frameworks/02-design-sprint.md +304 -0
- package/frameworks/03-foundation-sprint.md +337 -0
- package/frameworks/04-business-model-canvas.md +391 -0
- package/frameworks/05-customer-development.md +426 -0
- package/frameworks/06-jobs-to-be-done.md +358 -0
- package/frameworks/07-mom-test.md +392 -0
- package/frameworks/08-value-proposition-canvas.md +488 -0
- package/frameworks/09-javelin-board.md +428 -0
- package/frameworks/10-build-measure-learn.md +467 -0
- package/frameworks/11-mvp-approaches.md +533 -0
- package/frameworks/think-before-build.md +593 -0
- package/lib/assembler.js +197 -0
- package/lib/assembler.test.js +159 -0
- package/lib/detector.js +166 -0
- package/lib/detector.test.js +221 -0
- package/lib/packs.js +16 -0
- package/lib/resolver.js +272 -0
- package/lib/resolver.test.js +298 -0
- package/lib/worktree.sh +104 -0
- package/package.json +50 -0
- package/packs/backend-micronaut.yaml +35 -0
- package/packs/backend-nodejs.yaml +15 -0
- package/packs/backend-python.yaml +15 -0
- package/packs/core.yaml +37 -0
- package/packs/database.yaml +21 -0
- package/packs/frontend-react.yaml +24 -0
- package/packs/infrastructure.yaml +40 -0
- package/packs/ops.yaml +16 -0
- package/packs/packs.compiled.json +371 -0
- package/packs/product.yaml +22 -0
- package/packs/project-mgmt.yaml +24 -0
- package/packs/research.yaml +39 -0
- package/packs/shared-backend.yaml +14 -0
- package/packs/ux-design.yaml +21 -0
- package/rules/backend-micronaut/API_DESIGN.md +313 -0
- package/rules/backend-micronaut/BATCH_PROCESSING.md +92 -0
- package/rules/backend-micronaut/CONTROLLERS.md +388 -0
- package/rules/backend-micronaut/KOTLIN.md +414 -0
- package/rules/backend-micronaut/RETROFIT_PLACEMENT.md +290 -0
- package/rules/backend-micronaut/SERVICES_AND_BEANS.md +325 -0
- package/rules/core/NAMING_CONVENTIONS.md +208 -0
- package/rules/core/SKILL_AUTHORING.md +174 -0
- package/rules/core/TIMEZONE.md +316 -0
- package/rules/database/ORM_AND_REPO.md +289 -0
- package/rules/database/SCHEMA.md +146 -0
- package/rules/database/TRANSACTIONS.md +311 -0
- package/rules/frontend-react/FRONTEND.md +344 -0
- package/rules/infrastructure/MODULES.md +260 -0
- package/rules/infrastructure/NAMING.md +196 -0
- package/rules/infrastructure/PROVIDERS.md +309 -0
- package/rules/infrastructure/SECURITY.md +310 -0
- package/rules/infrastructure/STATE_AND_BACKEND.md +237 -0
- package/rules/infrastructure/STRUCTURE.md +234 -0
- package/rules/infrastructure/VARIABLES.md +285 -0
- package/rules/shared-backend/ARCHITECTURE.md +46 -0
- package/rules/ux-design/DESIGN_PROCESS.md +176 -0
- package/skills/api-endpoint-creator/SKILL.md +455 -0
- package/skills/api-endpoint-creator/error-handling-guide.md +244 -0
- package/skills/api-endpoint-creator/examples.md +522 -0
- package/skills/api-endpoint-creator/testing-patterns.md +302 -0
- package/skills/article-writing/SKILL.md +109 -0
- package/skills/article-writing/examples.md +59 -0
- package/skills/backend-api-design/SKILL.md +84 -0
- package/skills/backend-api-design/code-patterns.md +138 -0
- package/skills/brainstorm/SKILL.md +95 -0
- package/skills/browser-qa/SKILL.md +87 -0
- package/skills/browser-qa/playwright-snippets.md +110 -0
- package/skills/ci-cd-patterns/SKILL.md +108 -0
- package/skills/ci-cd-patterns/workflows.md +149 -0
- package/skills/competitive-teardown/SKILL.md +93 -0
- package/skills/competitive-teardown/example-analysis.md +50 -0
- package/skills/content-engine/SKILL.md +131 -0
- package/skills/content-engine/examples.md +72 -0
- package/skills/database-patterns/SKILL.md +72 -0
- package/skills/database-patterns/code-templates.md +114 -0
- package/skills/database-table-creator/SKILL.md +141 -0
- package/skills/database-table-creator/examples.md +552 -0
- package/skills/database-table-creator/kotlin-templates.md +400 -0
- package/skills/database-table-creator/migration-template.sql +68 -0
- package/skills/database-table-creator/validation-checklist.md +337 -0
- package/skills/deep-research/SKILL.md +80 -0
- package/skills/design-intelligence/SKILL.md +268 -0
- package/skills/design-workflow/SKILL.md +127 -0
- package/skills/design-workflow/checklists.md +45 -0
- package/skills/idea-validation/SKILL.md +129 -0
- package/skills/idea-validation/example-report.md +50 -0
- package/skills/investor-materials/SKILL.md +122 -0
- package/skills/investor-materials/example-outline.md +70 -0
- package/skills/investor-outreach/SKILL.md +112 -0
- package/skills/investor-outreach/examples.md +76 -0
- package/skills/kotlin-best-practices/SKILL.md +58 -0
- package/skills/kotlin-best-practices/code-patterns.md +132 -0
- package/skills/market-research/SKILL.md +99 -0
- package/skills/security-checklist/SKILL.md +65 -0
- package/skills/security-checklist/audit-reference.md +95 -0
- package/skills/service-debugging/SKILL.md +116 -0
- package/skills/service-debugging/common-issues.md +65 -0
- package/skills/startup-pipeline/SKILL.md +152 -0
- package/skills/terraform-best-practices/SKILL.md +244 -0
- package/skills/terraform-module-creator/SKILL.md +284 -0
- package/skills/terraform-review/SKILL.md +222 -0
- package/skills/terraform-security-audit/SKILL.md +280 -0
- package/skills/terraform-service-scaffold/SKILL.md +574 -0
- package/skills/testing-strategies/SKILL.md +116 -0
- package/skills/testing-strategies/examples.md +103 -0
- package/skills/testing-strategies/integration-test-setup.md +71 -0
- package/skills/ui-ux-pro-max/SKILL.md +238 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/python-setup.md +146 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/skills/web-to-prd/SKILL.md +478 -0
- package/templates/build-config.yaml +44 -0
- package/templates/commands-config.yaml +55 -0
- package/templates/competitor-analysis.md +60 -0
- package/templates/content/AGENT_TEMPLATE.md +47 -0
- package/templates/content/COMMAND_TEMPLATE.md +27 -0
- package/templates/content/RULE_TEMPLATE.md +40 -0
- package/templates/content/SKILL_TEMPLATE.md +41 -0
- package/templates/design-config.md +105 -0
- package/templates/design-doc.md +207 -0
- package/templates/epic.md +100 -0
- package/templates/feature-spec.md +181 -0
- package/templates/idea-canvas.md +47 -0
- package/templates/implementation-plan.md +159 -0
- package/templates/prd-template.md +86 -0
- package/templates/preamble.md +89 -0
- package/templates/project-readme.md +35 -0
- package/templates/quality-gates.md +230 -0
- package/templates/spartan-config.yaml +164 -0
- package/templates/user-interview.md +69 -0
- package/templates/validation-checklist.md +108 -0
- package/templates/workflow-backend-micronaut.md +409 -0
- package/templates/workflow-frontend-react.md +233 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.tf"
|
|
4
|
+
- "**/*.hcl"
|
|
5
|
+
- "**/*.tfvars"
|
|
6
|
+
---
|
|
7
|
+
# Resource and File Naming Conventions
|
|
8
|
+
|
|
9
|
+
## File Naming
|
|
10
|
+
|
|
11
|
+
All Terraform files use `snake_case.tf`. Module call files may use the service/resource name.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
# CORRECT
|
|
15
|
+
variables.tf
|
|
16
|
+
locals.tf
|
|
17
|
+
outputs.tf
|
|
18
|
+
provider.tf
|
|
19
|
+
ecr.tf
|
|
20
|
+
rds.tf
|
|
21
|
+
service_api.tf
|
|
22
|
+
|
|
23
|
+
# WRONG
|
|
24
|
+
Variables.tf
|
|
25
|
+
my-locals.tf
|
|
26
|
+
serviceApi.tf
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Variable Naming
|
|
32
|
+
|
|
33
|
+
Variables use `snake_case` with descriptive prefixes matching the resource type.
|
|
34
|
+
|
|
35
|
+
### WRONG -- Inconsistent or vague names
|
|
36
|
+
|
|
37
|
+
```hcl
|
|
38
|
+
variable "class" {
|
|
39
|
+
type = string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
variable "dbSubnets" {
|
|
43
|
+
type = list(string)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
variable "size" {
|
|
47
|
+
type = string
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### CORRECT -- Descriptive snake_case with resource prefix
|
|
52
|
+
|
|
53
|
+
```hcl
|
|
54
|
+
variable "rds_instance_class" {
|
|
55
|
+
description = "RDS instance class"
|
|
56
|
+
type = string
|
|
57
|
+
default = "db.t3.micro"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
variable "private_subnet_ids" {
|
|
61
|
+
description = "Private subnet IDs for data stores"
|
|
62
|
+
type = list(string)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
variable "redis_node_type" {
|
|
66
|
+
description = "ElastiCache node type"
|
|
67
|
+
type = string
|
|
68
|
+
default = "cache.t3.micro"
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Resource Naming Patterns
|
|
75
|
+
|
|
76
|
+
| Resource | Pattern | Example |
|
|
77
|
+
|----------|---------|---------|
|
|
78
|
+
| ECR repository | `{service}`, `{service}-worker` | `payment-api`, `payment-api-worker` |
|
|
79
|
+
| RDS identifier | `{service}-{random}` | `payment-api-abc123` |
|
|
80
|
+
| RDS database name | `{service_name}` (underscores) | `payment_api` |
|
|
81
|
+
| RDS username | `{service_name}` (underscores) | `payment_api` |
|
|
82
|
+
| S3 bucket | `{project}-{service}-{env}` | `myproject-payment-api-dev` |
|
|
83
|
+
| K8s namespace | `{service}` | `payment-api` |
|
|
84
|
+
| K8s service account | `{service}` | `payment-api` |
|
|
85
|
+
| SQS queue | `{service}-{queue_type}-{env}` | `payment-api-durable-job-dev` |
|
|
86
|
+
| Security group | `{service}-{purpose}-{env}` | `payment-api-redis-dev` |
|
|
87
|
+
| IAM role (IRSA) | `{service}-{env}-irsa` | `payment-api-dev-irsa` |
|
|
88
|
+
| S3 state bucket | `{project}-{region_short}-tf-{env}` | `myproject-uswest2-tf-dev` |
|
|
89
|
+
|
|
90
|
+
### WRONG -- Inconsistent naming
|
|
91
|
+
|
|
92
|
+
```hcl
|
|
93
|
+
module "ecr" {
|
|
94
|
+
name = "MyServiceAPI" # PascalCase
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
module "rds" {
|
|
98
|
+
identifier = "prod_database" # Underscores in identifier
|
|
99
|
+
database_name = "prod-db" # Hyphens in database name
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
resource "aws_sqs_queue" "jobs" {
|
|
103
|
+
name = "jobs" # No service or env context
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### CORRECT -- Consistent naming with context
|
|
108
|
+
|
|
109
|
+
```hcl
|
|
110
|
+
module "ecr" {
|
|
111
|
+
name = var.service_name # "payment-api"
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
module "rds" {
|
|
115
|
+
identifier = "${var.service_name}-${random_id.rds.hex}" # "payment-api-abc123"
|
|
116
|
+
database_name = replace(var.service_name, "-", "_") # "payment_api"
|
|
117
|
+
username = replace(var.service_name, "-", "_") # "payment_api"
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
resource "aws_sqs_queue" "durable_job" {
|
|
121
|
+
name = "${var.service_name}-durable-job-${var.environment}" # "payment-api-durable-job-dev"
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Tagging Strategy
|
|
128
|
+
|
|
129
|
+
Use provider-level `default_tags` instead of per-resource tags. Tags apply automatically to all AWS resources.
|
|
130
|
+
|
|
131
|
+
### WRONG -- Per-resource tags
|
|
132
|
+
|
|
133
|
+
```hcl
|
|
134
|
+
resource "aws_s3_bucket" "assets" {
|
|
135
|
+
bucket = "{project}-assets-dev"
|
|
136
|
+
tags = {
|
|
137
|
+
ManagedBy = "Terraform"
|
|
138
|
+
Environment = "dev"
|
|
139
|
+
Service = "payment-api"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
resource "aws_sqs_queue" "jobs" {
|
|
144
|
+
name = "payment-api-jobs-dev"
|
|
145
|
+
tags = {
|
|
146
|
+
ManagedBy = "Terraform"
|
|
147
|
+
Environment = "dev"
|
|
148
|
+
Service = "payment-api"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### CORRECT -- Provider default_tags
|
|
154
|
+
|
|
155
|
+
```hcl
|
|
156
|
+
# provider.tf
|
|
157
|
+
provider "aws" {
|
|
158
|
+
region = var.aws_region
|
|
159
|
+
|
|
160
|
+
default_tags {
|
|
161
|
+
tags = {
|
|
162
|
+
ManagedBy = "Terraform"
|
|
163
|
+
Service = var.service_name
|
|
164
|
+
Environment = var.environment
|
|
165
|
+
TerraformSource = "${var.service_name}/terraform/live"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
# Resources inherit tags automatically -- no per-resource tags needed
|
|
171
|
+
resource "aws_s3_bucket" "assets" {
|
|
172
|
+
bucket = "${var.project}-assets-${var.environment}"
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
resource "aws_sqs_queue" "jobs" {
|
|
176
|
+
name = "${var.service_name}-jobs-${var.environment}"
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Quick Reference
|
|
183
|
+
|
|
184
|
+
| Aspect | Rule |
|
|
185
|
+
|--------|------|
|
|
186
|
+
| File names | `snake_case.tf` |
|
|
187
|
+
| Variables | `snake_case` with resource prefix (`rds_instance_class`) |
|
|
188
|
+
| ECR | `{service}` or `{service}-{role}` |
|
|
189
|
+
| RDS identifier | `{service}-{random}` (hyphens) |
|
|
190
|
+
| RDS database/user | `{service_name}` (underscores) |
|
|
191
|
+
| S3 buckets | `{project}-{service}-{env}` |
|
|
192
|
+
| SQS queues | `{service}-{queue_type}-{env}` |
|
|
193
|
+
| IAM roles | `{service}-{env}-irsa` |
|
|
194
|
+
| State buckets | `{project}-{region_short}-tf-{env}` |
|
|
195
|
+
| Tags | Provider `default_tags`, never per-resource |
|
|
196
|
+
| K8s resources | `{service}` for namespace and service account |
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.tf"
|
|
4
|
+
- "**/*.hcl"
|
|
5
|
+
- "**/*.tfvars"
|
|
6
|
+
---
|
|
7
|
+
# Provider Configuration
|
|
8
|
+
|
|
9
|
+
## Providers Only in Live Layer
|
|
10
|
+
|
|
11
|
+
Providers are declared ONLY in the `live/` layer. Modules inherit providers from the caller. Never declare providers inside modules.
|
|
12
|
+
|
|
13
|
+
### WRONG -- Provider in module
|
|
14
|
+
|
|
15
|
+
```hcl
|
|
16
|
+
# modules/{service}/rds.tf
|
|
17
|
+
provider "aws" {
|
|
18
|
+
region = "us-west-2" # Provider inside a module
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module "rds" {
|
|
22
|
+
source = "c0x12c/rds/aws"
|
|
23
|
+
version = "~> 0.6.6"
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### CORRECT -- Provider in live layer only
|
|
28
|
+
|
|
29
|
+
```hcl
|
|
30
|
+
# live/provider.tf
|
|
31
|
+
provider "aws" {
|
|
32
|
+
region = module.config_aws.region
|
|
33
|
+
|
|
34
|
+
default_tags {
|
|
35
|
+
tags = module.config_aws.default_tags
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# modules/{service}/rds.tf -- no provider block, inherits from caller
|
|
40
|
+
module "rds" {
|
|
41
|
+
source = "c0x12c/rds/aws"
|
|
42
|
+
version = "~> 0.6.6"
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## AWS Provider with Default Tags
|
|
49
|
+
|
|
50
|
+
Always configure `default_tags` on the AWS provider. Tags apply automatically to all resources.
|
|
51
|
+
|
|
52
|
+
### WRONG -- No default tags
|
|
53
|
+
|
|
54
|
+
```hcl
|
|
55
|
+
provider "aws" {
|
|
56
|
+
region = "us-west-2"
|
|
57
|
+
# No default_tags -- every resource needs manual tags
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### CORRECT -- Default tags from config module
|
|
62
|
+
|
|
63
|
+
```hcl
|
|
64
|
+
provider "aws" {
|
|
65
|
+
region = module.config_aws.region
|
|
66
|
+
|
|
67
|
+
default_tags {
|
|
68
|
+
tags = {
|
|
69
|
+
ManagedBy = "Terraform"
|
|
70
|
+
Service = var.service_name
|
|
71
|
+
Environment = var.environment
|
|
72
|
+
TerraformSource = "${var.service_name}/terraform/live"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Provider Aliases for Multi-Region
|
|
81
|
+
|
|
82
|
+
Use aliases when resources must exist in a different region (e.g., ACM certificates in `us-east-1` for CloudFront).
|
|
83
|
+
|
|
84
|
+
```hcl
|
|
85
|
+
# live/provider.tf
|
|
86
|
+
provider "aws" {
|
|
87
|
+
region = module.config_aws.region
|
|
88
|
+
|
|
89
|
+
default_tags {
|
|
90
|
+
tags = module.config_aws.default_tags
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
provider "aws" {
|
|
95
|
+
alias = "global"
|
|
96
|
+
region = "us-east-1"
|
|
97
|
+
|
|
98
|
+
default_tags {
|
|
99
|
+
tags = module.config_aws.default_tags
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```hcl
|
|
105
|
+
# Usage in resources
|
|
106
|
+
resource "aws_acm_certificate" "cdn" {
|
|
107
|
+
provider = aws.global
|
|
108
|
+
domain_name = var.domain_name
|
|
109
|
+
validation_method = "DNS"
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## GitHub Provider with App Auth
|
|
116
|
+
|
|
117
|
+
Use GitHub App authentication with the `owner` field. Missing `owner` with App auth causes 403 errors on `/user` endpoint.
|
|
118
|
+
|
|
119
|
+
### WRONG -- Missing owner with App auth
|
|
120
|
+
|
|
121
|
+
```hcl
|
|
122
|
+
provider "github" {
|
|
123
|
+
# No owner field -- causes 403 on /user endpoint
|
|
124
|
+
app_auth {
|
|
125
|
+
id = var.github_app_id
|
|
126
|
+
pem_file = var.github_app_pem_file
|
|
127
|
+
installation_id = var.github_app_installation_id
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### WRONG -- PAT-based authentication
|
|
133
|
+
|
|
134
|
+
```hcl
|
|
135
|
+
provider "github" {
|
|
136
|
+
token = var.github_token # Personal Access Token -- security risk
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### CORRECT -- App auth with owner
|
|
141
|
+
|
|
142
|
+
```hcl
|
|
143
|
+
provider "github" {
|
|
144
|
+
owner = module.config_github.organization
|
|
145
|
+
|
|
146
|
+
app_auth {
|
|
147
|
+
id = module.config_github.app_id
|
|
148
|
+
pem_file = module.config_github.pem_file
|
|
149
|
+
installation_id = module.config_github.app_installation_id
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Kubernetes and Helm Providers
|
|
157
|
+
|
|
158
|
+
Kubernetes and Helm providers depend on EKS cluster outputs. Configure them after the EKS module.
|
|
159
|
+
|
|
160
|
+
```hcl
|
|
161
|
+
# live/provider.tf
|
|
162
|
+
data "aws_eks_cluster_auth" "cluster" {
|
|
163
|
+
name = module.eks.cluster_name
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
provider "kubernetes" {
|
|
167
|
+
host = module.eks.cluster_endpoint
|
|
168
|
+
token = data.aws_eks_cluster_auth.cluster.token
|
|
169
|
+
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
provider "helm" {
|
|
173
|
+
kubernetes {
|
|
174
|
+
host = module.eks.cluster_endpoint
|
|
175
|
+
token = data.aws_eks_cluster_auth.cluster.token
|
|
176
|
+
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Version Constraints
|
|
184
|
+
|
|
185
|
+
Always specify `required_version` for Terraform and version constraints for all providers.
|
|
186
|
+
|
|
187
|
+
### WRONG -- No version constraints
|
|
188
|
+
|
|
189
|
+
```hcl
|
|
190
|
+
terraform {
|
|
191
|
+
# No required_version -- any Terraform version accepted
|
|
192
|
+
required_providers {
|
|
193
|
+
aws = {
|
|
194
|
+
source = "hashicorp/aws"
|
|
195
|
+
# No version -- pulls latest, unpredictable
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### CORRECT -- Explicit version constraints
|
|
202
|
+
|
|
203
|
+
```hcl
|
|
204
|
+
terraform {
|
|
205
|
+
required_version = ">= 1.11"
|
|
206
|
+
|
|
207
|
+
required_providers {
|
|
208
|
+
aws = {
|
|
209
|
+
source = "hashicorp/aws"
|
|
210
|
+
version = "~> 5.0"
|
|
211
|
+
}
|
|
212
|
+
github = {
|
|
213
|
+
source = "integrations/github"
|
|
214
|
+
version = "~> 6.0"
|
|
215
|
+
}
|
|
216
|
+
kubernetes = {
|
|
217
|
+
source = "hashicorp/kubernetes"
|
|
218
|
+
version = "~> 2.20"
|
|
219
|
+
}
|
|
220
|
+
helm = {
|
|
221
|
+
source = "hashicorp/helm"
|
|
222
|
+
version = "~> 2.10"
|
|
223
|
+
}
|
|
224
|
+
random = {
|
|
225
|
+
source = "hashicorp/random"
|
|
226
|
+
version = "~> 3.5"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Complete Provider File Example
|
|
235
|
+
|
|
236
|
+
```hcl
|
|
237
|
+
# live/provider.tf
|
|
238
|
+
|
|
239
|
+
provider "aws" {
|
|
240
|
+
region = module.config_aws.region
|
|
241
|
+
|
|
242
|
+
default_tags {
|
|
243
|
+
tags = {
|
|
244
|
+
ManagedBy = "Terraform"
|
|
245
|
+
Service = var.service_name
|
|
246
|
+
Environment = var.environment
|
|
247
|
+
TerraformSource = "${var.service_name}/terraform/live"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
provider "aws" {
|
|
253
|
+
alias = "global"
|
|
254
|
+
region = "us-east-1"
|
|
255
|
+
|
|
256
|
+
default_tags {
|
|
257
|
+
tags = {
|
|
258
|
+
ManagedBy = "Terraform"
|
|
259
|
+
Service = var.service_name
|
|
260
|
+
Environment = var.environment
|
|
261
|
+
TerraformSource = "${var.service_name}/terraform/live"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
provider "github" {
|
|
267
|
+
owner = module.config_github.organization
|
|
268
|
+
|
|
269
|
+
app_auth {
|
|
270
|
+
id = module.config_github.app_id
|
|
271
|
+
pem_file = module.config_github.pem_file
|
|
272
|
+
installation_id = module.config_github.app_installation_id
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
data "aws_eks_cluster_auth" "cluster" {
|
|
277
|
+
name = module.eks.cluster_name
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
provider "kubernetes" {
|
|
281
|
+
host = module.eks.cluster_endpoint
|
|
282
|
+
token = data.aws_eks_cluster_auth.cluster.token
|
|
283
|
+
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
provider "helm" {
|
|
287
|
+
kubernetes {
|
|
288
|
+
host = module.eks.cluster_endpoint
|
|
289
|
+
token = data.aws_eks_cluster_auth.cluster.token
|
|
290
|
+
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Quick Reference
|
|
298
|
+
|
|
299
|
+
| Aspect | Rule |
|
|
300
|
+
|--------|------|
|
|
301
|
+
| Provider location | Only in `live/` layer, never in modules |
|
|
302
|
+
| AWS default_tags | Always configured, applied to all resources |
|
|
303
|
+
| Multi-region | Use `alias = "global"` for us-east-1 resources |
|
|
304
|
+
| GitHub auth | App auth with `owner` field, never PATs |
|
|
305
|
+
| GitHub owner | REQUIRED with App auth (403 without it) |
|
|
306
|
+
| Kubernetes/Helm | Configured from EKS module outputs |
|
|
307
|
+
| required_version | Always set (e.g., `>= 1.11`) |
|
|
308
|
+
| Provider versions | Pessimistic pinning (`~> X.Y`) on all providers |
|
|
309
|
+
| Module providers | Modules inherit, never declare their own |
|