skills/terraform/SKILL.md
Terraform authoring patterns — directory structure, backend config, workspace-per-environment, variable management, and mise task wrappers for GCP and AWS. Load when writing .tf files, configuring backends, managing workspaces, or running tf-init/tf-plan/tf-apply tasks.
npx skillsauth add cloudvoyant/codevoyant terraformInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Patterns for structuring and maintaining Terraform configurations. Core conventions are cloud-agnostic; cloud-specific recipes cover GCP (nv-gcp-template) and AWS.
| You are working on… | Load recipe |
|---|---|
| Directory structure and module layout | references/recipes/structure.md |
| GCP backend (GCS) and workspace management | references/recipes/gcp-backend-workspaces.md |
| GCP variable and tfvars management | references/recipes/gcp-variables.md |
| AWS backend (S3) and workspace management | references/recipes/aws-backend-workspaces.md |
| AWS variable and provider setup | references/recipes/aws-variables.md |
For mise task wrappers (tf-init, tf-plan, tf-apply, tf-destroy) see the mise skill — recipes terraform-gcp and terraform-aws.
infra/ at the repo rootinfra/shared/ (one-time shared resources) and infra/environments/ (per-workspace deployments)dev, stage, prod, preview-*-var flags in mise tasks — never via committed terraform.tfvarsTF_VAR_* env vars (CI) or cloud-native secret stores (runtime)required_providers in versions.tf; Terraform version pinned to major in mise.tomlinfra/
shared/ ← one-time shared resources (CDN, registry, IAM)
main.tf
variables.tf
outputs.tf
providers.tf
backend.tf
versions.tf
terraform.tfvars.example ← gitignored tfvars go alongside (never committed)
environments/ ← per-environment resources (Cloud Run, storage, secrets)
main.tf
variables.tf
outputs.tf
providers.tf
backend.tf
versions.tf
modules/ ← reusable modules
cdn/
storage-bucket/
nv-fullstack-app/
GCS backend with workspace support:
# infra/environments/backend.tf
terraform {
backend "gcs" {
# Bucket and prefix passed via -backend-config during tf-init
# State paths:
# ${GCP_PROJECT_ID}/${PROJECT}/env:/dev/default.tfstate
# ${GCP_PROJECT_ID}/${PROJECT}/env:/stage/default.tfstate
}
}
Never hardcode the bucket name — it's passed by mise run tf-init.
Standard variable set for GCP environments:
variable "project" { type = string }
variable "gcp_project_id" { type = string }
variable "gcp_region" { type = string }
variable "environment_name" { type = string } # dev | stage | prod | preview-*
variable "app_image" { type = string; default = "" } # set via TF_VAR_app_image in CI
variable "gcp_devops_project_id" { type = string }
variable "gcp_devops_docker_registry_name" { type = string }
app_image defaults to empty — CI sets TF_VAR_app_image to the built image tag.
# infra/environments/providers.tf
provider "google" {
project = var.gcp_project_id
region = var.gcp_region
default_labels = {
project = var.project
environment = var.environment_name
managed_by = "terraform"
}
}
Always set default_labels so every GCP resource carries environment and project metadata.
terraform.tfvars — use .example files and pass vars via mise tasks.tfstate files — state lives in GCS.terraform/environment to default before terraform init in non-TTY contexts (CI) to avoid stale workspace promptsterraform init -reconfigure required when switching backends or prefixesTF_VAR_* env vars for CI secrets, not -var flags in scripts that might end up in logsdevelopment
React patterns: Zustand state management, shadcn/ui + Tailwind CSS, React Three Fiber + Drei for 3D, folder structure, data fetching, and TypeScript conventions. Load when working on React projects (*.tsx) without SvelteKit.
development
QA workflows: investigate and document bugs, post issues to GitHub/GitLab/Linear, and run browser-agent smoke tests. Triggers on: 'qa debug', 'qa report', 'qa smoke', 'run smoke test', 'report bug', 'investigate issue'.
tools
Python project patterns: uv package/workspace management, MLflow experiment tracking, Ray distributed computing, Nvidia Warp GPU kernels, Pydantic validation, Click CLIs, and service architecture. Load when writing Python with pyproject.toml or uv.lock.
development
Code review workflows: create a draft PR/MR, generate AI-powered inline review comments, address change requests, or complete a draft review. Triggers on: "pr open", "pr new", "pr review", "pr address", "pr complete", "open a PR", "create a draft PR", "code review", "pr mr", "pr this PR", "address pr comments", "fix review comments", "complete draft review", "publish review".