config/agents/skills/terraform/SKILL.md
Terraform Expert Engineer Skill - Comprehensive guide for Infrastructure as Code, resource management, module design, and state management Use when: - Running terraform init, plan, apply, destroy - Managing Terraform state (import, move, rm) - Designing modules or configuring backends - Working with HCP Terraform / Terraform Cloud
npx skillsauth add kumewata/dotfiles 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.
This skill provides a comprehensive guide for Terraform development.
# Initialize workspace (download providers)
terraform init
# Initialize with backend config
terraform init -backend-config="bucket=my-terraform-state"
# Check execution plan
terraform plan
# Save execution plan to file
terraform plan -out=tfplan
# Plan specific resource only
terraform plan -target=aws_instance.example
WARNING: These commands modify infrastructure.
Always run terraform plan first and ask user permission.
# Apply changes
terraform apply
# Apply saved plan
terraform apply tfplan
# Auto-approve apply (for CI/CD)
terraform apply -auto-approve
# Destroy resources
terraform destroy
# Destroy specific resource only
terraform destroy -target=aws_instance.example
# Check state
terraform state list
# Show resource details
terraform state show aws_instance.example
# Move resource (for refactoring)
terraform state mv aws_instance.old aws_instance.new
# Import existing resource
terraform import aws_instance.example i-1234567890abcdef0
# Remove resource from state (keeps actual resource)
terraform state rm aws_instance.example
# Validate configuration
terraform validate
# Format
terraform fmt
# Format recursively
terraform fmt -recursive
# Check outputs
terraform output
# Output in JSON format
terraform output -json
# Interactive console (for testing expressions)
terraform console
# Lock providers
terraform providers lock -platform=linux_amd64 -platform=darwin_amd64
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
tags = {
Name = "example-instance"
}
}
depends_on: Explicit dependenciescount: Resource replication (index-based)for_each: Resource replication (key-based)provider: Specify alternate providerlifecycle: Lifecycle controlresource "aws_instance" "example" {
# ...
lifecycle {
create_before_destroy = true # Create new first on replacement
prevent_destroy = true # Prevent deletion
ignore_changes = [tags] # Attributes to ignore changes
replace_triggered_by = [null_resource.trigger.id]
}
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "5.0.0"
name = "my-vpc"
cidr = "10.0.0.0/16"
}
./modules/vpchashicorp/consul/awsgithub.com/hashicorp/examples3::https://s3-eu-west-1.amazonaws.com/bucket/module.zipmain.tf, variables.tf, outputs.tfterraform {
backend "s3" {
bucket = "my-terraform-state"
key = "prod/terraform.tfstate"
region = "ap-northeast-1"
encrypt = true
dynamodb_table = "terraform-locks"
}
}
terraform state commands)variable "instance_type" {
type = string
description = "EC2 instance type"
default = "t2.micro"
validation {
condition = contains(["t2.micro", "t2.small", "t2.medium"], var.instance_type)
error_message = "Please specify an allowed instance type"
}
}
-var, -var-file*.auto.tfvars filesterraform.tfvars.jsonterraform.tfvarsTF_VAR_*variable "db_password" {
type = string
sensitive = true # Mask in output
}
output "connection_string" {
value = "postgres://user:${var.db_password}@host/db"
sensitive = true # Output contains sensitive data
}
Note: Sensitive data is stored in plaintext in state files. Remote backend encryption or HCP Terraform recommended.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = "ap-northeast-1"
}
provider "aws" {
alias = "us_east"
region = "us-east-1"
}
provider "aws" {
alias = "ap_northeast"
region = "ap-northeast-1"
}
resource "aws_instance" "us" {
provider = aws.us_east
# ...
}
# String operations
join("-", ["foo", "bar"]) # "foo-bar"
split(",", "a,b,c") # ["a", "b", "c"]
format("Hello, %s!", "World") # "Hello, World!"
# Collection operations
length(["a", "b", "c"]) # 3
lookup(map, key, default) # Get value from map
merge(map1, map2) # Merge maps
flatten([["a"], ["b", "c"]]) # ["a", "b", "c"]
# Type conversions
tostring(123) # "123"
tolist(set) # Set to list
tomap(object) # Object to map
# Conditional expressions
coalesce("", "default") # "default" (first non-empty value)
try(expression, fallback) # Fallback on error
terraform {
cloud {
organization = "my-org"
workspaces {
name = "my-workspace"
}
}
}
.terraform/ to .gitignore*.tfvars to .gitignore (if contains sensitive info)tools
Use when creating a new skill or making a substantial change to an existing skill and you also need to design, update, or review Waza-based executable evaluations. This includes deciding whether Waza is warranted, mapping `evals.json` cases into Waza tasks, choosing fixtures and graders, selecting a valid model with `waza models --json`, and running a local-first `waza run` workflow. Do NOT use for installing the Waza CLI itself or for general skill-authoring advice that does not involve Waza; use `skill-creator` for skill design and this skill for the Waza execution layer. Trigger especially when the user mentions Waza, `waza run`, `waza models`, executable evals, compare, graders, fixtures, or wants to validate a skill change with model-backed evaluation.
tools
Use when the user wants Codex to ask Claude Code for a second opinion or review on code, docs, diffs, PR changes, or design notes without modifying files. This delegates bounded review-only analysis through the Claude Code CLI (`claude -p`). Do NOT use for implementation or file edits; keep this skill review-only. Trigger especially when the user says ask Claude, ask Claude Code, cc-delegate, Claude review, second opinion from Claude, compare Codex and Claude, or review this diff/document with Claude Code.
tools
Airflow DAG development skill for writing, reviewing, testing, and debugging Apache Airflow workflows. Use whenever the user mentions Airflow, DAGs, tasks, operators, sensors, schedules, retries, catchup, DAG import errors, DAG parse performance, or workflow orchestration in Python. Also use for Amazon MWAA / Managed Workflows for Apache Airflow work, including MWAA DAG deployment, requirements.txt, plugins.zip, aws-mwaa-docker-images, S3 DAG folders, CloudWatch logs, and MWAA-specific dependency or IAM issues.
development
Use when the user asks for help drafting a GitHub PR description, a PR review comment, or a Slack post in their own tone (i.e., their personal writing voice). The skill detects the context (formal for PR / review, casual for Slack) and target_type (pr_description, pr_review, slack), drafts the body with an explicit reflection step that avoids verbose, mechanical phrasing, and stages the draft to `~/.local/state/tone/drafts/` via `tone-stage-draft.sh`. The user later runs `/tone-capture <url>` after posting, which pairs the staged draft with the final body to build a corpus for future tone tuning. Trigger especially when the user mentions PR description, PR review comment, Slack post, または「文を書いて」「文面を作って」「自分らしく」「トーン」「tone」.