/major-ai-skills:terraformfrom major-ai-skills
Write reviewable Terraform with remote state locks, moved-block refactors, and plan-first applies; catch destructive replaces, drift, and state surgery mistakes before production.
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.
Terraform (and compatible OpenTofu) declares infrastructure in HCL; providers reconcile API objects against state. A plan is the contract: it shows create/update/destroy. Agents treat state as confidential, locking as mandatory, and refactors as moved blocks in Git—not casual state mv on laptops.
┌─────────────────────────────────────────────────────────────┐
│ Terraform execution graph │
│ │
│ Config (*.tf, modules) + variables │
│ ↓ init (providers, backend) │
│ State (remote S3/GCS/Azure + lock) ←→ refresh │
│ ↓ plan (graph diff) → saved plan artifact │
│ ↓ apply (ordered API calls) │
│ Outputs → downstream modules / CI / @kubernetes │
└─────────────────────────────────────────────────────────────┘
Use when
-/+ replacements on stateful resources.moved), importing existing cloud objects, or documenting drift response.Do not use when
@ansible.@helm / @argocd.@aws-cli, etc.) alongside IaC, not instead of it..tfstate or disable -lock routinely.moved blocks (Terraform ≥1.1); keep historical moved in shared modules for upgrade paths.state rm/mv: terraform state pull > backup.tfstate; verify next plan is empty of surprise destroys.plan -refresh-only records reality—it does not revert drift; normal apply reverts accidental manual changes when safe.required_version and provider versions (~> on major); read provider changelogs on bumps.terraform output -json.terraform {
required_version = ">= 1.6.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
backend "s3" {
bucket = "org-tf-state"
key = "prod/network/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "org-tf-locks"
encrypt = true
}
}
moved {
from = aws_subnet.public_a
to = module.network.aws_subnet.public["a"]
}
module "network" {
source = "./modules/network"
vpc_cidr = var.vpc_cidr
}
Safe CI loop:
terraform init -input=false
terraform fmt -check -recursive
terraform validate
terraform plan -input=false -out=tfplan
terraform show -no-color tfplan | tee plan.txt
# human review — then:
terraform apply -input=false tfplan
| Plan signal | Risk | Action |
|---|---|---|
-/+ replace on RDS, EBS, stateful disk | Data loss / downtime | Stop; snapshot; maintenance window; maybe create_before_destroy |
Large destroy count after refactor | Missing moved / wrong address | Add moved; never “apply through” |
forces replacement on SG attached widely | Connection blips | Assess dependents; staged apply |
| Provider upgrade with many changes | Provider bug or schema shift | Staging plan first; pin if needed |
| Import + immediate destroy | Config ≠ reality | Fix HCL to match; re-plan |
| Symptom | Likely cause | Fix |
|---|---|---|
| Error acquiring state lock | Stale CI job / crashed apply | Identify holder; force-unlock only after confirming no active apply |
| Perpetual diff on tags/defaults | Provider defaulting or ignore_changes gap | Explicit tags; lifecycle ignore documented |
| Resource exists in cloud, not in state | Created manually | import block / terraform import; match attributes |
| Two workspaces same resource | Duplicate state ownership | One state per env; split addresses |
| Apply OK but app broken | Wrong output wired downstream | Trace output → k8s/helm values |
for_each with stable keys over count index keys for resources that may reorder.@github-actions OIDC role).prevent_destroy on critical data stores with documented break-glass removal process.plan -refresh-only in CI) and ticket non-empty diffs.@kubernetes — consume cluster outputs safely@github-actions — plan/apply pipelines with OIDC@aws-cli / @gcloud-cli / @azure-cli — imperative verification@helm — deploy apps after cluster exists@vault — dynamic secrets for providers where supportedMANDATORY: Never approve apply when the plan destroys or replaces stateful resources without explicit human intent. Use
movedblocks for address changes. Backup state before manual surgery. Treat-lock=falseand casualforce-unlockas incident-level exceptions. Separate drift acceptance (-refresh-only) from drift reversion (normal apply).
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