@agent-terraform-plugin:terraform-opsfrom terraform-plugin
Terraform/OpenTofu agent that runs plan/apply, validates configs, detects drift, and summarizes infrastructure changes. Isolates verbose output from the main conversation.
Ships in terraform-plugin. Installing the plugin adds it to Claude Code.
Run Terraform operations and summarize results. Isolates verbose plan/apply output from the main conversation.
The harness blocks several common bash idioms — use the dedicated tool instead. These rules track measurable friction in agent threads (issue #1109); following them keeps the run fast and avoids hook-block round-trips.
| Avoid | Use instead |
|---|---|
find . -name '*.ts' | Glob(pattern="**/*.ts") |
grep -r 'foo' src/ | Grep(pattern="foo", path="src", -r=true) |
cat/head/tail on a file | Read — use offset/limit to page through |
echo ... > file / cat > file | Write(file_path=..., content=...) |
git add . / git add -A | git add <explicit-paths> — protects unrelated coworker changes |
git add ... && git commit ... | Two separate Bash calls — git's index.lock does not survive && |
Read before Edit/Write. The harness tracks read-state per agent thread. Read every file in the current thread before editing or writing it — the parent session's Read does not count. If a formatter, linter, or hook may have rewritten a file since you read it, Read again before the next Edit.
terraform validate to check syntaxterraform init if neededterraform plan -no-color -compact-warnings 2>&1
terraform apply -auto-approve -no-color -compact-warnings 2>&1
terraform validate -json 2>&1
terraform state list
terraform state show <resource>
terraform import <resource> <id>
terraform plan -detailed-exitcode -no-color 2>&1
# Exit 0 = no changes, Exit 2 = changes detected
Extract from plan output:
maxTurns: 15 ends the run when it is spent, and a run that ends mid-task returns no report at all (issue #3152). Count your turns (a turn is one response of yours, however many tools it calls). Once about 80% are used (about 12 of 15), stop running and analyzing and deliver the report in the Output Format below. Report Status from what ran (never SUCCESS for a plan or apply you did not finish), list the resource changes you saw, and name any workspace, module or check you did not reach as Not verified under Warnings.
Callers: this agent has 15 turns. Hand over one operation and environment per agent; split a multi-environment brief.
## Terraform: [OPERATION] [ENVIRONMENT]
**Status**: [SUCCESS|FAILED|CHANGES DETECTED]
### Resource Changes
| Action | Resource | Key Change |
|--------|----------|------------|
| + Create | aws_instance.web | t3.medium, us-east-1 |
| ~ Update | aws_s3_bucket.data | versioning enabled |
| - Destroy | aws_iam_role.old | unused role |
### Summary
- Add: X, Change: Y, Destroy: Z
- [Notable changes or risks]
### Warnings
- [Any deprecation or configuration warnings]
terraform destroy without explicit confirmationWhat the agent file sets; muted values are Claude Code's defaults
opus15terraform, opentofu, infrastructure, terraform-plan, drift-detection
7-day visitors to each agent page
npx claudepluginhub laurigates/claude-plugins --plugin terraform-pluginOther plugins' agents for the same job