@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,280 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: terraform-security-audit
|
|
3
|
+
description: Security audit for Terraform codebases covering IAM, networking, encryption, secrets, access control, and compliance. Use before prod deploys, periodic audits, or new service security review.
|
|
4
|
+
allowed_tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Glob
|
|
7
|
+
- Grep
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Terraform Security Audit
|
|
11
|
+
|
|
12
|
+
Runs a 6-area security audit on Terraform codebases. Produces a pass/fail report per area.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- Security review before production deployment
|
|
17
|
+
- Periodic infrastructure security audit
|
|
18
|
+
- New service setup validation
|
|
19
|
+
- Post-incident security hardening check
|
|
20
|
+
|
|
21
|
+
## Process
|
|
22
|
+
|
|
23
|
+
### 1. IAM — Identity and Access Management
|
|
24
|
+
|
|
25
|
+
- [ ] OIDC used for CI/CD (no long-lived access keys)
|
|
26
|
+
- [ ] IRSA for EKS workloads (no node-level IAM)
|
|
27
|
+
- [ ] ECS task roles scoped per service (no shared roles)
|
|
28
|
+
- [ ] IAM policies follow least privilege
|
|
29
|
+
- [ ] No `*` actions on `*` resources
|
|
30
|
+
- [ ] No inline policies (use managed or customer policies)
|
|
31
|
+
- [ ] Assume role conditions include `ExternalId` or `sts:SourceIdentity`
|
|
32
|
+
|
|
33
|
+
```hcl
|
|
34
|
+
# INSECURE — overly broad permissions
|
|
35
|
+
resource "aws_iam_policy" "bad" {
|
|
36
|
+
policy = jsonencode({
|
|
37
|
+
Statement = [{
|
|
38
|
+
Effect = "Allow"
|
|
39
|
+
Action = "*"
|
|
40
|
+
Resource = "*"
|
|
41
|
+
}]
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# SECURE — scoped to specific actions and resources
|
|
46
|
+
resource "aws_iam_policy" "good" {
|
|
47
|
+
policy = jsonencode({
|
|
48
|
+
Statement = [{
|
|
49
|
+
Effect = "Allow"
|
|
50
|
+
Action = ["s3:GetObject", "s3:PutObject"]
|
|
51
|
+
Resource = "${aws_s3_bucket.assets.arn}/*"
|
|
52
|
+
}]
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```hcl
|
|
58
|
+
# SECURE — IRSA for EKS pods
|
|
59
|
+
module "irsa" {
|
|
60
|
+
source = "git::https://github.com/{project}/terraform-modules.git//irsa?ref=v1.0.0"
|
|
61
|
+
|
|
62
|
+
name = "${local.name_prefix}-irsa"
|
|
63
|
+
oidc_provider_arn = var.oidc_provider_arn
|
|
64
|
+
namespace = var.service
|
|
65
|
+
service_account = var.service
|
|
66
|
+
policy_arns = [aws_iam_policy.service.arn]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Network — VPC and Security Groups
|
|
71
|
+
|
|
72
|
+
- [ ] Databases in private subnets only
|
|
73
|
+
- [ ] No `0.0.0.0/0` ingress except ALB on 443
|
|
74
|
+
- [ ] Security groups use `source_security_group_id`, not CIDR
|
|
75
|
+
- [ ] Egress restricted where possible
|
|
76
|
+
- [ ] VPC flow logs enabled
|
|
77
|
+
- [ ] No public IPs on non-bastion instances
|
|
78
|
+
|
|
79
|
+
```hcl
|
|
80
|
+
# INSECURE — database accessible from anywhere
|
|
81
|
+
resource "aws_security_group_rule" "rds_bad" {
|
|
82
|
+
type = "ingress"
|
|
83
|
+
from_port = 5432
|
|
84
|
+
to_port = 5432
|
|
85
|
+
protocol = "tcp"
|
|
86
|
+
cidr_blocks = ["0.0.0.0/0"]
|
|
87
|
+
security_group_id = aws_security_group.rds.id
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# SECURE — database only from app security group
|
|
91
|
+
resource "aws_security_group_rule" "rds_good" {
|
|
92
|
+
type = "ingress"
|
|
93
|
+
from_port = 5432
|
|
94
|
+
to_port = 5432
|
|
95
|
+
protocol = "tcp"
|
|
96
|
+
source_security_group_id = aws_security_group.app.id
|
|
97
|
+
security_group_id = aws_security_group.rds.id
|
|
98
|
+
description = "PostgreSQL access from application"
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 3. Encryption — Data at Rest and in Transit
|
|
103
|
+
|
|
104
|
+
- [ ] S3: SSE enabled (KMS or AES-256)
|
|
105
|
+
- [ ] RDS: `storage_encrypted = true`
|
|
106
|
+
- [ ] RDS: `ssl_enforcement` via parameter group
|
|
107
|
+
- [ ] Redis: `transit_encryption_enabled = true`
|
|
108
|
+
- [ ] Redis: `at_rest_encryption_enabled = true`
|
|
109
|
+
- [ ] EBS volumes encrypted
|
|
110
|
+
- [ ] Terraform state bucket encrypted with SSE-KMS
|
|
111
|
+
- [ ] ALB uses TLS 1.2+ only
|
|
112
|
+
|
|
113
|
+
```hcl
|
|
114
|
+
# INSECURE — no encryption
|
|
115
|
+
resource "aws_db_instance" "bad" {
|
|
116
|
+
storage_encrypted = false # default
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# SECURE — encryption enabled
|
|
120
|
+
resource "aws_db_instance" "good" {
|
|
121
|
+
storage_encrypted = true
|
|
122
|
+
kms_key_id = var.rds_kms_key_arn
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```hcl
|
|
127
|
+
# SECURE — Redis encryption
|
|
128
|
+
module "redis" {
|
|
129
|
+
source = "git::https://github.com/{project}/terraform-modules.git//elasticache?ref=v1.0.0"
|
|
130
|
+
|
|
131
|
+
transit_encryption = true
|
|
132
|
+
at_rest_encryption = true
|
|
133
|
+
auth_token = var.redis_auth_token
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 4. Secrets — Secret Management
|
|
138
|
+
|
|
139
|
+
- [ ] No secrets in `.tf` files or committed `.tfvars`
|
|
140
|
+
- [ ] `secrets.tfvars` in `.gitignore`
|
|
141
|
+
- [ ] Sensitive variables marked `sensitive = true`
|
|
142
|
+
- [ ] Secrets injected via CI/CD environment variables
|
|
143
|
+
- [ ] No plaintext passwords in state (use `sensitive` output)
|
|
144
|
+
- [ ] git-secret-protector or pre-commit hooks block accidental commits
|
|
145
|
+
|
|
146
|
+
```hcl
|
|
147
|
+
# INSECURE — password in code
|
|
148
|
+
resource "aws_db_instance" "bad" {
|
|
149
|
+
password = "SuperSecret123!"
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
# SECURE — from variable, marked sensitive
|
|
153
|
+
variable "db_password" {
|
|
154
|
+
description = "Database master password"
|
|
155
|
+
type = string
|
|
156
|
+
sensitive = true
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
resource "aws_db_instance" "good" {
|
|
160
|
+
password = var.db_password
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
```hcl
|
|
165
|
+
# SECURE — sensitive output
|
|
166
|
+
output "connection_string" {
|
|
167
|
+
value = "postgresql://${var.db_user}:${var.db_password}@${aws_db_instance.main.endpoint}/${var.db_name}"
|
|
168
|
+
sensitive = true
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 5. Access — Cluster and Console Access
|
|
173
|
+
|
|
174
|
+
- [ ] EKS `aws-auth` ConfigMap restricts access to needed roles
|
|
175
|
+
- [ ] SSO used for console access (no IAM users with passwords)
|
|
176
|
+
- [ ] Bastion host in private subnet with Session Manager (no SSH keys)
|
|
177
|
+
- [ ] CloudTrail enabled for API audit logging
|
|
178
|
+
- [ ] MFA enforced on human accounts
|
|
179
|
+
|
|
180
|
+
```hcl
|
|
181
|
+
# EKS access control
|
|
182
|
+
resource "kubernetes_config_map" "aws_auth" {
|
|
183
|
+
metadata {
|
|
184
|
+
name = "aws-auth"
|
|
185
|
+
namespace = "kube-system"
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
data = {
|
|
189
|
+
mapRoles = yamlencode([
|
|
190
|
+
{
|
|
191
|
+
rolearn = var.admin_role_arn
|
|
192
|
+
username = "admin"
|
|
193
|
+
groups = ["system:masters"]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
rolearn = var.node_role_arn
|
|
197
|
+
username = "system:node:{{EC2PrivateDNSName}}"
|
|
198
|
+
groups = ["system:bootstrappers", "system:nodes"]
|
|
199
|
+
}
|
|
200
|
+
])
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 6. Compliance — Tags, Naming, and Backups
|
|
206
|
+
|
|
207
|
+
- [ ] All resources tagged: Project, Service, Environment, ManagedBy
|
|
208
|
+
- [ ] Naming follows `{project}-{service}-{env}` convention
|
|
209
|
+
- [ ] RDS automated backups enabled (retention >= 7 days, 30 for prod)
|
|
210
|
+
- [ ] S3 versioning enabled on data buckets
|
|
211
|
+
- [ ] DynamoDB point-in-time recovery enabled
|
|
212
|
+
- [ ] CloudWatch alarms on critical metrics
|
|
213
|
+
- [ ] Cost allocation tags configured
|
|
214
|
+
|
|
215
|
+
```hcl
|
|
216
|
+
# CORRECT — default tags at provider level
|
|
217
|
+
provider "aws" {
|
|
218
|
+
default_tags {
|
|
219
|
+
tags = {
|
|
220
|
+
Project = var.project
|
|
221
|
+
Service = var.service
|
|
222
|
+
Environment = var.env
|
|
223
|
+
ManagedBy = "terraform"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
# CORRECT — backup retention
|
|
229
|
+
resource "aws_db_instance" "main" {
|
|
230
|
+
backup_retention_period = var.env == "prod" ? 30 : 7
|
|
231
|
+
backup_window = "03:00-04:00"
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Interaction Style
|
|
236
|
+
|
|
237
|
+
- Scans all `.tf` files in the codebase
|
|
238
|
+
- Checks every area — does not skip sections
|
|
239
|
+
- Highlights critical findings first (IAM wildcards, public access, missing encryption)
|
|
240
|
+
- Provides remediation code for each failing check
|
|
241
|
+
|
|
242
|
+
## Rules
|
|
243
|
+
|
|
244
|
+
- Critical: IAM `*/*`, public database access, unencrypted storage, secrets in code
|
|
245
|
+
- Warning: Missing tags, short backup retention, no flow logs
|
|
246
|
+
- Info: Missing descriptions, optional hardening not applied
|
|
247
|
+
|
|
248
|
+
## Output
|
|
249
|
+
|
|
250
|
+
Produces a security audit report:
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
## Terraform Security Audit: {service}
|
|
254
|
+
|
|
255
|
+
### Overall: Pass | Fail
|
|
256
|
+
|
|
257
|
+
| Area | Status | Critical | Warnings | Info |
|
|
258
|
+
|------------|----------|----------|----------|------|
|
|
259
|
+
| IAM | Pass | 0 | 0 | 1 |
|
|
260
|
+
| Network | Fail | 1 | 0 | 0 |
|
|
261
|
+
| Encryption | Pass | 0 | 1 | 0 |
|
|
262
|
+
| Secrets | Pass | 0 | 0 | 0 |
|
|
263
|
+
| Access | Pass | 0 | 0 | 1 |
|
|
264
|
+
| Compliance | Warning | 0 | 2 | 0 |
|
|
265
|
+
|
|
266
|
+
### Critical Findings
|
|
267
|
+
- **[Network]** Security group `rds_main` allows ingress from 0.0.0.0/0 on port 5432
|
|
268
|
+
- File: `modules/{service}/sg.tf:15`
|
|
269
|
+
- Fix: Replace `cidr_blocks` with `source_security_group_id`
|
|
270
|
+
|
|
271
|
+
### Warnings
|
|
272
|
+
- **[Encryption]** Redis `at_rest_encryption` not enabled
|
|
273
|
+
- File: `modules/{service}/redis.tf:8`
|
|
274
|
+
- Fix: Add `at_rest_encryption = true`
|
|
275
|
+
|
|
276
|
+
### Remediation Priority
|
|
277
|
+
1. Fix critical findings before any deployment
|
|
278
|
+
2. Address warnings before production promotion
|
|
279
|
+
3. Info items for next sprint
|
|
280
|
+
```
|