From devops
Write infrastructure-as-code using Terraform or Pulumi. Produces a module or stack with resource definitions, variables, outputs, and documentation. Use when provisioning cloud infrastructure, defining environments, or creating reusable infrastructure modules.
npx claudepluginhub hpsgd/turtlestack --plugin devopsThis skill is limited to using the following tools:
Write infrastructure-as-code for $ARGUMENTS.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Guides agent creation for Claude Code plugins with file templates, frontmatter specs (name, description, model), triggering examples, system prompts, and best practices.
Write infrastructure-as-code for $ARGUMENTS.
Follow every step below. The output must be a complete, deployable module — not a skeleton or snippet.
Before writing any IaC:
*.tf files (Terraform), Pulumi.yaml / Pulumi.*.yaml (Pulumi), main.tf, provider.tf, versions.tf, or __main__.py / index.ts (Pulumi programs)modules/, infra/, or a shared infrastructure repo. Reuse before creatingprovider blocks or Pulumi.yaml runtimebackend blocks or Pulumi.*.yaml backend config{env}-{service}-{resource})If no IaC tool is detected, default to Terraform with HCL. Ask the user to confirm before proceeding with Pulumi.
Before writing code, plan the resources:
{environment}-{service}-{resource-type}Document the resource graph as a comment block at the top of the main file:
# Resource Graph:
# VPC → Subnets (public, private) → Route Tables → NAT Gateway
# → Security Groups
# → Load Balancer → Target Group
modules/{module-name}/
├── main.tf # Resource definitions
├── variables.tf # Input variables
├── outputs.tf # Output values
├── versions.tf # Provider and Terraform version constraints
├── data.tf # Data sources (if needed)
├── locals.tf # Local values (if needed)
└── README.md # Usage documentation
infra/{stack-name}/
├── Pulumi.yaml # Project metadata
├── Pulumi.dev.yaml # Dev stack config
├── Pulumi.prod.yaml # Prod stack config
├── index.ts / __main__.py # Program entry
└── README.md # Usage documentation
Every variable must have a description, type, and validation rule where applicable:
variable "environment" {
description = "Deployment environment (dev, staging, prod)"
type = string
validation {
condition = contains(["dev", "staging", "prod"], var.environment)
error_message = "Environment must be one of: dev, staging, prod."
}
}
variable "instance_type" {
description = "EC2 instance type for the application server"
type = string
default = "t3.medium"
validation {
condition = can(regex("^t3\\.", var.instance_type))
error_message = "Only t3 instance types are permitted for this module."
}
}
Use pulumi.Config with typed accessors and validation:
const config = new pulumi.Config();
const environment = config.require("environment"); // Fails if not set
const instanceType = config.get("instanceType") || "t3.medium";
# versions.tf
terraform {
required_version = ">= 1.5.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
backend "s3" {
bucket = "company-terraform-state"
key = "modules/{module-name}/terraform.tfstate"
region = "eu-west-1"
encrypt = true
dynamodb_table = "terraform-lock"
}
}
# Pulumi.yaml
name: module-name
runtime: nodejs # or python
description: What this stack provisions
Rules:
~>) — allows patch updates, blocks breaking changesterraform.tfstate on disk) outside local developmentEvery module includes a README.md with:
# Module: {name}
{One paragraph: what this module provisions and why.}
## Usage
\```hcl
module "example" {
source = "./modules/{name}"
environment = "dev"
instance_type = "t3.medium"
vpc_id = module.network.vpc_id
}
\```
## Inputs
| Name | Type | Default | Description |
|------|------|---------|-------------|
| environment | string | — | Deployment environment |
| instance_type | string | "t3.medium" | EC2 instance type |
## Outputs
| Name | Description |
|------|-------------|
| instance_id | ID of the created EC2 instance |
| public_ip | Public IP address (if assigned) |
## Prerequisites
- VPC must exist (use the `network` module)
- IAM role for the instance profile must exist
Run validation checks before delivering:
terraform fmt -check -recursive # Format check
terraform validate # Syntax and reference validation
terraform plan # Dry run (if credentials available)
pulumi preview # Dry run
If validation commands are not available (no credentials, no Terraform installed), note the required verification steps for the user to run.
network and database modules. Compose them at the stack level.apply..tf or Pulumi code.environment, team, service, and managed-by tags. Use a locals block or default tags on the provider.for_each over count — count creates index-based resources that break when items are removed from the middle of a list. for_each uses stable keys.terraform destroy without confirmation — document the destroy procedure in the README.Deliver:
main.tf, variables.tf, outputs.tf, versions.tf (Terraform) or index.ts/__main__.py + Pulumi.yaml (Pulumi)terraform validate / pulumi preview (or instructions to run)/devops:write-pipeline — the CI/CD pipeline deploys the infrastructure. Add terraform plan to PR checks and terraform apply to the deploy stage./devops:write-dockerfile — containers run on the infrastructure this module provisions. Coordinate instance types, networking, and security groups.Use the Terraform module template (templates/terraform-module/) for output structure.