home / skills / bobmatnyc / claude-mpm-skills / terraform
This skill helps you implement Terraform workflows with safe plan/apply, state management, and CI guardrails for reliable infrastructure.
npx playbooks add skill bobmatnyc/claude-mpm-skills --skill terraformReview the files below or copy the command above to add this skill to your agents.
---
name: terraform
description: "Terraform infrastructure-as-code workflow patterns: state and environments, module design, safe plan/apply, drift control, and CI guardrails"
version: 1.0.0
category: universal
author: Claude MPM Team
license: MIT
progressive_disclosure:
entry_point:
summary: "Manage infrastructure safely with Terraform: remote state, reproducible plans, reviewable changes, and guardrails"
when_to_use: "When provisioning cloud or platform resources, standardizing environments, or building safe IaC workflows"
quick_start: "1. Pin versions 2. terraform init/fmt/validate 3. Plan in CI 4. Review + approve 5. Apply with locking"
token_estimate:
entry: 140
full: 8000
context_limit: 900
tags:
- terraform
- iac
- infrastructure
- provisioning
- ci
- state
requires_tools:
- terraform
---
# Terraform
## Quick Start (workflow)
```bash
terraform init
terraform plan -out=tfplan
terraform apply tfplan
```
## Safety Checklist
- State: remote backend + locking; separate state per environment
- Reviews: plan in CI; apply from a trusted runner with approvals
- Guardrails: `prevent_destroy` and policy checks for prod
## Load Next (References)
- `references/state-and-environments.md` — backends, locking, workspaces vs separate state, drift
- `references/modules-and-composition.md` — module interfaces, versioning, composition patterns
- `references/workflows-and-guardrails.md` — CI plan/apply, policy-as-code, safe migrations
This skill captures proven Terraform infrastructure-as-code workflow patterns for safe, scalable, and auditable provisioning. It focuses on state and environment management, module design, safe plan/apply workflows, drift control, and CI guardrails. Use it to standardize Terraform operations and reduce risk during changes.
The skill inspects and codifies recommended practices: remote state backends with locking, environment separation, module interface and versioning patterns, and CI-driven plan/apply flows. It outlines safety controls such as plan reviews, restricted applies, prevent_destroy safeguards, and policy-as-code checks. It also guides drift detection and remediation approaches.
Should I use workspaces or separate state files for environments?
Prefer separate state per environment or per component for clearer isolation and simpler lifecycle management; use workspaces for lightweight variations, not as a full environment isolation strategy.
How do I safely run terraform apply in CI?
Run plan in CI and store the plan artifact. Perform apply only from a trusted runner with manual approval or automated guardrails, and ensure state backend locking and policy checks are in place.