Full-stack-skills terraform
Provides comprehensive guidance for Terraform including infrastructure as code, providers, modules, state management, and multi-cloud resource provisioning. Use when the user asks about Terraform, needs to create IaC configurations, manage cloud resources, or implement Terraform best practices.
install
source · Clone the upstream repo
git clone https://github.com/partme-ai/full-stack-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/partme-ai/full-stack-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/devops-skills/terraform" ~/.claude/skills/partme-ai-full-stack-skills-terraform && rm -rf "$T"
manifest:
skills/devops-skills/terraform/SKILL.mdsource content
When to use this skill
Use this skill whenever the user wants to:
- Write or debug Terraform configuration files (
).tf - Manage cloud infrastructure (AWS, Azure, GCP, etc.)
- Configure providers, resources, data sources, and outputs
- Manage Terraform state, modules, and workspaces
How to use this skill
Workflow
- Write configuration — define providers, resources, variables, and outputs in HCL
- Initialize — run
to download providers and modulesterraform init - Plan — run
to preview changesterraform plan - Apply — run
to provision infrastructureterraform apply - Validate — confirm resources with
and cloud consoleterraform state list
Quick Start Example
# main.tf terraform { required_version = ">= 1.5" required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } backend "s3" { bucket = "myapp-terraform-state" key = "prod/terraform.tfstate" region = "us-east-1" dynamodb_table = "terraform-locks" } } provider "aws" { region = var.aws_region } variable "aws_region" { description = "AWS region for resources" type = string default = "us-east-1" } resource "aws_s3_bucket" "app_assets" { bucket = "myapp-${var.environment}-assets" tags = { Environment = var.environment ManagedBy = "terraform" } } output "bucket_arn" { value = aws_s3_bucket.app_assets.arn }
# Standard workflow terraform init terraform fmt # Format code terraform validate # Check syntax terraform plan # Preview changes terraform apply # Apply changes # State inspection terraform state list terraform state show aws_s3_bucket.app_assets
Module Usage Example
module "vpc" { source = "terraform-aws-modules/vpc/aws" version = "~> 5.0" name = "myapp-vpc" cidr = "10.0.0.0/16" azs = ["us-east-1a", "us-east-1b"] private_subnets = ["10.0.1.0/24", "10.0.2.0/24"] public_subnets = ["10.0.101.0/24", "10.0.102.0/24"] }
Best Practices
- Use remote state (S3 + DynamoDB, Azure Blob, etc.) to avoid state file conflicts
- Store sensitive values in variables or environment variables — never hardcode in
files.tf - Run
andterraform fmt
before every committerraform validate - Use workspaces or directory-based environments for isolation (dev/staging/prod)
- Version-pin providers and modules to avoid unexpected breaking changes
Troubleshooting
- State lock error: Check for stale locks in DynamoDB/backend; use
as last resortterraform force-unlock - Provider version conflict: Pin versions in
and runrequired_providersterraform init -upgrade - Drift detected: Run
to see differences; import or taint resources as neededterraform plan - Destroy hanging: Check for resource dependencies; use
for selective destruction-target
Keywords
terraform, iac, infrastructure as code, hcl, aws, azure, gcp, modules, state management, cloud provisioning