/major-ai-skills:terraform-awsfrom major-ai-skills
Design AWS Terraform with pinned providers, S3 remote state (native lockfile), least-privilege IAM, and OIDC CI apply gates agents routinely get wrong.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill specializes @terraform for AWS: provider configuration, reusable modules (VPC, ECS/EKS, RDS, IAM), remote state on S3, and tag/IAM conventions. Prefer S3 native state locking (use_lockfile = true; DynamoDB locking is deprecated). Agents write least-privilege policies, keep one env per state (or a clear workspace strategy), never commit access keys, and gate plan → human/CI review → apply. Prefer GitHub OIDC → IAM role over long-lived CI keys.
┌─────────────────────────────────────────────────────────────┐
│ Terraform AWS control plane │
│ │
│ Root module (env: prod/staging) │
│ └── child modules: network · data · app · iam │
│ │
│ Provider │
│ ├── hashicorp/aws (version pinned) │
│ └── Creds: OIDC role / SSO profile / instance role │
│ │
│ State │
│ ├── S3 bucket (versioning + encrypt) │
│ ├── use_lockfile = true (prefer; DynamoDB deprecated) │
│ └── Optional dual-lock during migration │
│ │
│ CI │
│ └── fmt → validate → plan -out → review → apply │
└─────────────────────────────────────────────────────────────┘
Use when
Do not use when
@terraform.@aws-cli..tf / committed .tfvars → refuse; use OIDC, SSO, or @vault / SSM / Secrets Manager data sources.required_version, hashicorp/aws provider, and module versions; upgrade deliberately.use_lockfile = true; migrate off dynamodb_table when possible.* in production without explicit review; prefer roles over users.terraform plan -out=tfplan artifact reviewed before apply; OIDC role with S3 state perms including lock object delete.terraform {
required_version = ">= 1.10.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
backend "s3" {
bucket = "acme-tf-state"
key = "app/prod/terraform.tfstate"
region = "us-east-1"
encrypt = true
use_lockfile = true
# During migration from DynamoDB locks you may set dynamodb_table too;
# remove it once all runners are on Terraform >= 1.10 with lockfile support.
}
}
provider "aws" {
region = var.aws_region
default_tags {
tags = {
Environment = var.environment
Owner = var.owner
Service = var.service
ManagedBy = "terraform"
}
}
}
data "aws_iam_policy_document" "task" {
statement {
sid = "ReadConfig"
actions = ["s3:GetObject"]
resources = ["arn:aws:s3:::acme-app-config/${var.environment}/*"]
}
}
resource "aws_iam_role" "task" {
name = "${var.service}-${var.environment}-task"
assume_role_policy = data.aws_iam_policy_document.task_assume.json
}
resource "aws_iam_role_policy" "task" {
name = "task-inline"
role = aws_iam_role.task.id
policy = data.aws_iam_policy_document.task.json
}
Validation loop:
terraform fmt -check -recursive
terraform init
terraform validate
terraform plan -out=tfplan
terraform show -no-color tfplan | head -n 200
# Apply only after review:
# terraform apply tfplan
CI needs id-token: write + role trust on token.actions.githubusercontent.com. Backend IAM must allow lock cleanup (s3:DeleteObject on the .tflock object; DynamoDB DeleteItem if still dual-locking).
| Signature | Likely cause | Fix path |
|---|---|---|
Error acquiring the state lock | Concurrent apply; crashed runner left lock; missing delete perms | Confirm no other run; terraform force-unlock <ID> only if safe; grant lock delete IAM |
| Backend assume-role / OIDC fail | Trust policy sub mismatch; missing id-token: write | Fix GitHub OIDC trust; configure-aws-credentials before init |
| Plan wants replace on “harmless” change | ForceNew attr (name, AZ, engine) | Read plan carefully; use lifecycle / blue-green; accept downtime explicitly |
| AccessDenied on apply but plan OK | Apply role narrower than plan; SCP | Align roles; check Org SCPs with @aws-cli |
| Drift after Console click-ops | Out-of-band change | terraform refresh / plan; import or revert in Console |
| Hard-coded AMI / AZ breaks region | No data sources | aws_ami / aws_availability_zones data; variables |
default_tags; enforce via policy in CI.@docker; EKS apps with @kubernetes.aws_cli / CloudFormation escape hatches—document and retire.force-unlock can corrupt state if another apply is live—verify first.@terraform — language, state, and workflow fundamentals@aws-cli — imperative verify beside plan/apply@pulumi — alternative AWS IaC@kubernetes — EKS workloads after cluster module@docker / @github-actions — image + OIDC apply pipelines@vault — dynamic secrets vs static tfvarsMANDATORY: Pin provider/module versions. Use S3 remote state with
use_lockfile = true(treat DynamoDB locking as legacy). Prefer OIDC/SSO/roles over access keys. Never commit secrets in.tf/.tfvars. Summarize create/update/replace/delete before apply; require explicit approval for destroy/replace of stateful resources. If account or backend is unclear, stop and ask.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job