
Terraform
- 222 installs
- 63 repo stars
- Updated July 18, 2026
- bobmatnyc/claude-mpm-skills
Author, review, and apply Terraform modules to provision cloud networking, compute, storage, IAM, and environment-specific stacks with safe state management.
About
Covers Terraform infrastructure-as-code for cloud platforms: structuring modules, managing remote state, wiring IAM and networking, planning safe applies, and operating multi-environment stacks with reviewable, repeatable provisioning workflows.
- Module design and variable/output contracts
- Remote state, locking, and workspace strategy
- IAM least-privilege resource policies
- Plan/apply review and drift detection
- Multi-environment promotion patterns
Terraform by the numbers
- 222 all-time installs (skills.sh)
- Ranked #446 of 1,039 Cloud & Infrastructure skills by installs in the Skillselion catalog
- Data as of Aug 1, 2026 (Skillselion catalog sync)
npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill terraformAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 222 |
|---|---|
| repo stars | ★ 63 |
| Last updated | July 18, 2026 |
| Repository | bobmatnyc/claude-mpm-skills ↗ |
What it does
Author, review, and apply Terraform modules to provision cloud networking, compute, storage, IAM, and environment-specific stacks with safe state management.
Files
Terraform
Quick Start (workflow)
terraform init
terraform plan -out=tfplan
terraform apply tfplanSafety Checklist
- State: remote backend + locking; separate state per environment
- Reviews: plan in CI; apply from a trusted runner with approvals
- Guardrails:
prevent_destroyand policy checks for prod
Load Next (References)
references/state-and-environments.md— backends, locking, workspaces vs separate state, driftreferences/modules-and-composition.md— module interfaces, versioning, composition patternsreferences/workflows-and-guardrails.md— CI plan/apply, policy-as-code, safe migrations
{
"name": "terraform",
"version": "1.0.0",
"category": "universal",
"toolchain": null,
"tags": [
"terraform",
"iac",
"infrastructure",
"provisioning",
"state",
"modules",
"ci",
"policy"
],
"entry_point_tokens": 140,
"full_tokens": 1291,
"related_skills": [
"github-actions",
"security-scanning",
"writing-plans",
"verification-before-completion"
],
"author": "Claude MPM Team",
"license": "MIT",
"subcategory": "infrastructure",
"description": "Terraform infrastructure-as-code workflow patterns: remote state, environments, module design, safe plan/apply, drift control, and CI guardrails",
"self_contained": true,
"requires": [],
"repository": "https://github.com/bobmatnyc/claude-mpm-skills",
"created": "2025-12-17",
"updated": "2025-12-17",
"notes": [
"Emphasizes state safety, reviewable changes, and CI guardrails",
"Cloud/provider examples are intentionally minimal; focus is transferable patterns"
]
}
Modules and Composition
Module Design Principles
- Keep module interfaces small and stable (inputs/outputs).
- Avoid over-abstraction; start with a root module, extract modules when duplication appears.
- Version modules and pin versions in consumers.
Recommended structure:
- Root module per environment (or per stack)
- Reusable modules for common building blocks (network, compute, database)
Inputs and Outputs
Patterns:
- Use typed variables with validation
- Expose only what downstream consumers need
variable "environment" {
type = string
description = "Deployment environment (dev/staging/prod)"
validation {
condition = contains(["dev", "staging", "prod"], var.environment)
error_message = "environment must be dev, staging, or prod"
}
}Iteration and Addressing
Prefer for_each over count when stable addressing matters:
for_eachuses keys (more stable across inserts)countshifts indexes when items are inserted/deleted
Safe Refactors
When renaming resources or moving them into modules:
- Use
movedblocks (Terraform 1.1+) where possible - Or use
terraform state mvwith care and review
Testing
Practical baseline:
terraform fmt,validate, andplanin CI on every PR- Add policy checks (security/cost) for production stacks
Optional:
- Terratest (Go) for integration tests
terraform test(if standardised in the repo and tooling)
State and Environments
State Safety Rules
- Use a remote backend with locking for any shared environment.
- Treat state as sensitive; it often contains resource attributes and secrets.
- Separate state for production vs non-production to limit blast radius.
Backends and Locking
Patterns:
- Remote object store backend + lock table (common)
- Managed backend with built-in locking and history (common)
Checklist:
- Enable encryption at rest
- Restrict IAM access to the backend (read/write only for CI and break-glass operators)
- Enable versioning for state history
Environments: Workspaces vs Separate State
Prefer separate state per environment for most teams:
- Clear separation of prod vs staging
- Independent locking, permissions, and retention
- Fewer workspace foot-guns
Use workspaces when:
- A single root module is intentionally shared
- Workspace isolation is well understood and enforced in tooling
Drift, Imports, and State Ops
Drift:
- Run
planregularly in CI to detect drift (or scheduled checks).
Imports:
- Use
terraform importfor adopting existing resources. - Follow with a
planto confirm parity.
State commands (use carefully):
terraform state list
terraform state show <addr>
terraform state mv <from> <to>
terraform state rm <addr>Avoid manual edits of the state file.
Secrets
If a provider returns a secret value, it can land in state.
Patterns:
- Use secret managers for secret generation and distribution
- Prefer references (ARN/ID/path) over raw secret values
- Restrict state access and audit reads
Workflows and Guardrails
Standard Workflow
1) Format + validate (fmt, validate) 2) Plan in CI and publish the plan output 3) Review the plan (including diffs to sensitive resources) 4) Apply from a trusted runner after approval
Avoid ad-hoc local applies for shared environments.
Guardrails in Code
Lifecycle protections:
lifecycle {
prevent_destroy = true
create_before_destroy = true
}Change management:
- Require explicit approvals for production applies
- Require plan-only for PRs and apply-only for protected branches
Policy and Security Checks
Common additions:
tflint(linting)trivy config,tfsec, orcheckov(IaC security)- Conftest/OPA or Sentinel for policy-as-code
- Cost estimation gates (where applicable)
Migrations and Renames
Safer patterns:
- Use
movedblocks for refactors - Apply in small steps
- Avoid
-targetexcept for recovery and controlled migrations
Disaster Recovery
Checklist:
- Versioned remote state
- Backend access logs enabled
- Document break-glass procedure for state recovery and unlocks