Skip to content
Back to skills

Terraform

ASecurity

Terraform/OpenTofu — module design and versioning, remote state with locking, environments via workspaces or directories, plan review, drift detection, `moved` and `import` blocks, policy as code, provider pinning, secrets handling. Use for infrastructure as code (Terraform, OpenTofu, IaC, module, state, plan, drift).

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsgoterraform

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add vectora-os/kit --skill terraform --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Terraform?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Terraform
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectora-os-terraform/badge)](https://www.skillsdirectory.com/skills/vectora-os-terraform)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: terraform
description: Terraform/OpenTofu — module design and versioning, remote state with locking, environments via workspaces or directories, plan review, drift detection, `moved` and `import` blocks, policy as code, provider pinning, secrets handling. Use for infrastructure as code (Terraform, OpenTofu, IaC, module, state, plan, drift).
metadata:
  category: infrastructure
---

# Terraform

## Purpose

Manage infrastructure as reviewable, modular, reproducible code.

**Use when:** any infrastructure change.

**Not for:** manual console changes.

## Inputs

- Infrastructure design, current state.

## Outputs

- Modules, plan output, drift report.

## Read first

- [Project Brain](../../../project-brain/README.md) — `npm run brain -- query "terraform"` for prior decisions, patterns and anti-patterns.

## Steps

1. **Modules.** Small composable modules with inputs validated and outputs documented.
   Done when modules are versioned.
2. **State.** Remote state, locking, one state per environment and component.
   Done when blast radius bounded.
3. **Plan.** Plan in CI on PR; review for destroys and replacements.
   Done when plan attached to PR.
4. **Drift.** Scheduled drift detection; import or fix.
   Done when drift is zero or explained.

## Best practices

- Pin provider versions.
- Refactor with `moved` blocks to avoid recreation.

## Common mistakes

- Secrets in state without encryption.
- One giant state file.

## Example

VPC refactor to a module with `moved` blocks; plan shows 0 to add, 0 to destroy.

## Reusable prompt

```text
Apply the Terraform skill (.agents/skills/terraform/SKILL.md).
Context: {{task card or question; links to PRD, ADRs, code paths}}
Constraints: {{approved thresholds, deadlines, allowed files}}
Structure or review the Terraform: modules, state layout, plan review and drift handling.
Return: Modules, plan output, drift report..
Cite evidence (file:line, command output, source) for every claim; list open questions separately.
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.