This skill helps you implement Terraform IaC patterns, state management, security, and modular design to ensure scalable, secure infrastructure.
npx playbooks add skill yldgio/codereview-skills --skill terraform
${} or {{}} interpolation with unvalidated or undeclared input. Always sanitize and declare variables prior to use<!-- -->) is not valid in Terraform files and must be flagged as an error if present. Use only valid Terraform comment syntax (# or //). Provide reasons for non-obvious configurations directly alongside related resourcessensitive = truemain.tf, variables.tf, outputs.tf, providers.tfterraform.tfvars for environment-specific values (never commit secrets)*.tfstate files out of version controlvariables.tfdescription for all variablestype constraints (string, number, bool, list, map, object)default values where appropriatesensitive = true for secretsvalidation blocks for input constraintsmain.tf, variables.tf, outputs.tf, README.mdrandom provider for unique suffixes when neededterraform fmt for consistent formattingterraform validate before applyingterraform plan to review changes before applycount or for_each over duplicate resource blockslocals for computed values and reduce repetitiondepends_on only when implicit dependencies aren't sufficientrequired_providers blocktflint, checkov) for quality and securityterraform test or similarterraform plancreate_before_destroy, prevent_destroy) appropriatelyprevent_destroy on critical resourcescreate_before_destroy to avoid downtime during updatessensitive = truedescriptionterraform {
required_version = ">= 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
backend "s3" {
bucket = "my-terraform-state"
key = "prod/terraform.tfstate"
region = "us-east-1"
encrypt = true
dynamodb_table = "terraform-locks"
}
}
variable "environment" {
description = "Environment name"
type = string
validation {
condition = contains(["dev", "staging", "prod"], var.environment)
error_message = "Environment must be dev, staging, or prod."
}
}
variable "db_password" {
description = "Database password"
type = string
sensitive = true
}
locals {
base_name = "myapp-${var.environment}"
common_tags = {
Environment = var.environment
ManagedBy = "terraform"
}
}
resource "aws_s3_bucket" "main" {
bucket = "${local.base_name}-data"
tags = local.common_tags
}
output "bucket_arn" {
description = "ARN of the S3 bucket"
value = aws_s3_bucket.main.arn
}Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.