# terraform-specialist

A Terraform subagent that builds modules, wires up remote state and hunts drift. Useful once your infrastructure outgrows a single main.tf.

- subagent · `type=agent` · Claude Code · 1349 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/agents/devops-infrastructure/terraform-specialist.md
- Updated: 2026-10-25
- HTML: https://affpapa.org/en/nevibecode/agents/terraform-specialist

## What it does

This subagent treats infrastructure as code: it designs modules with input variables, sets up a backend for remote state, and pins providers with version constraints. It also handles workspaces for multiple environments, imports existing resources and detects drift.

The agent follows a fixed set of habits. It keeps things DRY, treats state files as sacred and backs them up, reviews `plan` before `apply`, locks provider versions for reproducibility, and pulls values from data sources instead of hardcoding them. Output includes modules, backend configuration, provider requirements, Makefile or scripts for routine operations, and pre-commit hooks for validation. You also get `.tfvars` examples plus both `plan` and `apply` output.

Its toolset is small: Read, Write, Edit and Bash. So it edits your configuration directly and runs commands through the shell, which means it touches your working directory and your provider credentials. Have Terraform installed and backend access configured before the first run, or `plan` will not build. And if the project has a state file that people have edited by hand, back it up first: the agent reshapes configuration into modules, and any mismatch shows up on the very first plan.

## Requirements
- Works with: Terraform

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --agent devops-infrastructure/terraform-specialist
```

2. **Manually: put the files in place**
- File: `.claude/agents/terraform-specialist.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

### Codex

**Manually: put the files in place**
- File: `.codex/agents/terraform-specialist.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/terraform-specialist.md` — Cursor also reads .claude/agents/

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/agents/devops-infrastructure/terraform-specialist.md

## When to use it
- split a sprawling `main.tf` into reusable modules
- move state to S3, Azure Storage or Terraform Cloud
- pin provider versions so builds stop drifting apart
- separate environments with workspaces
- import existing resources and surface config drift

## Example prompts
- Split this `main.tf` into modules with input variables and show me a `.tfvars` example
- Set up remote state in S3 and add version constraints for the AWS provider
- Check for drift between the current state and the config, then propose an import plan

## Similar
- [huawei-cloud-terraform-installer](https://affpapa.org/en/nevibecode/skills/huawei-cloud-terraform-installer.md) — skill · 17400 installs
- [huawei-cloud-terraform-generator](https://affpapa.org/en/nevibecode/skills/huawei-cloud-terraform-generator.md) — skill · 17000 installs
- [terraform-skill](https://affpapa.org/en/nevibecode/skills/terraform-skill.md) — skill · 7400 installs
- [terraform-stacks](https://affpapa.org/en/nevibecode/skills/terraform-stacks.md) — skill · 5600 installs
- [terraform](https://affpapa.org/en/nevibecode/plugins/terraform.md) — plugin · ★ 44635
- [terraform-azure](https://affpapa.org/en/nevibecode/rules/terraform-azure.md) — rule · ★ 40418

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 361 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
