Generates new Helm module directories following established patterns. Ensures consistency with existing modules and registers new modules across all required files. Use when adding new Helm charts or scaffolding module structures.
Generates new Helm module directories following established patterns in Terraform+Helm codebases. Ensures consistency with existing modules and registers the new module across all required files.
This skill activates when the user requests:
Do NOT assume a fixed directory structure. Discover the Helm module conventions at runtime:
Search for directories containing helm_release resources or Helm chart configs:
grep -rl 'helm_release\|resource.*helm' --include="*.tf" . | grep -v '.terraform/' | xargs dirname | sort -u
This identifies the module directory pattern (e.g., modules/helm/<name>/, modules/<name>/, helm/<name>/).
Search for the Terraform file that registers Helm modules:
grep -rl 'source\s*=.*modules.*helm\|module.*helm' --include="*.tf" . | grep -v '.terraform/'
Store as <orchestrator-file> (e.g., 3-gke-package.tf, main.tf, helm.tf).
Read 2-3 existing modules to discover the conventions used in this repo:
install_version vs chart_version vs versionvariable.tf vs variables.tf, main.tf structurecommon.yaml + configs-{env}.yaml, or values.yaml + values-{env}.yamlhelm_release.this vs helm_release.<name>depends_on patterns used in the orchestrator filefind . -name "*.md" -not -path "./.terraform/*" | xargs grep -l '\-\-version\|helm.*install\|helm.*upgrade' 2>/dev/null
Store as <version-doc> if found. New modules should be registered here.
grep -rl 'workload_identity\|google_service_account' --include="*.tf" . | grep -v '.terraform/'
Store as <identity-file> if found. Needed when workload_identity = true.
Ask the user for:
| Input | Required | Default | Example |
|---|---|---|---|
| Chart name | Yes | — | redis |
| Helm repository URL | Yes | — | https://charts.bitnami.com/bitnami |
| Chart version | Yes | — | 17.11.3 |
| Namespace | Yes | Chart name | redis |
| Release name | No | Chart name | redis |
| Environments | No | dev,stg,prd | dev,stg,prd |
| DR support | No | true | true or false |
| Workload identity | No | false | true (needs SA name + roles) |
| CRDs | No | false | true if chart needs installCRDs |
| Shared namespace | No | false | true if using existing namespace like monitoring |
Based on inputs, select from 5 module patterns defined in MODULE_PATTERNS.md:
| Pattern | When to Use |
|---|---|
| Simple | No env-specific config, minimal setup (like keda) |
| Standard | Env-specific configs, DR support (like argocd) |
| Workload Identity | Needs GCP SA with yamlencode injection (like loki) |
| OCI | Chart from OCI registry, no repository field (like litellm) |
| Multi-Instance | Same chart deployed multiple times (like gitlab-runner) |
Create the new module directory following the pattern discovered in Step 0a (e.g., modules/helm/<chart-name>/ or whatever convention the repo uses). Generate files matching the conventions from Step 0c:
main.tfhelm_release resource (use the naming convention discovered in Step 0c, e.g., this or <chart-name>)variables.tf or variable.tf)name — string with default matching chart namenamespace — string with default matching namespace inputinstall_version, chart_version, or version) — string with default matching version inputenvironment — string, no default (if env configs needed)dr — bool, no default (if DR support)project_id — string, no default (if workload identity)common.yamlconfigs-{env}.yaml (per environment)configs-{env}-dr.yaml (if DR support)Add a module block to the discovered <orchestrator-file> (from Step 0b), following the established pattern from existing modules:
module "<chart-name>" {
name = "<release-name>"
source = "<discovered-module-path>/<chart-name>" # Match Step 0a pattern
install_version = "<version>" # Use the version variable name from Step 0c
namespace = "<namespace>"
environment = local.environment
dr = local.dr
depends_on = [module.gke]
}
Adjust depends_on based on:
kubernetes_namespace.workload_identitymodule.kedamodule.cert-managerSkip if no version doc was discovered in Step 0d.
Add a new section to <version-doc> with the manual helm install command:
# <chart-name>
\`\`\`bash
helm repo add <repo-name> <repo-url>
helm repo update
helm upgrade --install <release-name> <repo-name>/<chart-name> --create-namespace --version <version> -n <namespace> --values common.yaml --values configs-dev.yaml
\`\`\`
Skip if no identity file was discovered in Step 0e.
If workload identity is required:
<identity-file>List all created/modified files and suggest next steps:
terraform validateterraform plan -target=module.<chart-name>terraform apply -target=module.<chart-name>modules/helm/<name>/, variables.tf, install_version).helm-modules.tf).When invoked with --dry-run or when the user asks to "preview":
Would create: modules/helm/redis/main.tf (42 lines)
Would create: modules/helm/redis/variables.tf (28 lines)
Would create: modules/helm/redis/common.yaml (15 lines)
Would create: modules/helm/redis/configs-dev.yaml (8 lines)
Since this skill creates new files and modifies existing ones:
rm -rf <module-directory># To undo this scaffold:
rm -rf <module-directory>
git checkout -- <orchestrator-file> <version-doc> <identity-file>