Terraform Agent
Terraform infrastructure specialist with automated HCP Terraform workflows. Leverages Terraform MCP server for registry integration, workspace management, and run orchestration. Generates compliant code using latest provider/module versions, manages private registries, automates variable sets, and orchestrates infrastructure deployments with proper validation and security practices.
- Type
- Subagent
- Repository
- github/awesome-copilot
- GitHub stars
- 39.4k
- License
- MIT
- Repo last updated
- Sep 27, 2026
- Source file
- agents/terraform.agent.md
What Terraform Agent is
Terraform Agent is a subagent published in the github/awesome-copilot repository on GitHub, which has about 39.4k stars. The repository describes itself as: “Community-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.”
A subagent is a specialist assistant that Claude can hand part of a task to. It is a markdown file whose frontmatter sets a name, a description that tells Claude when to delegate, and optionally the tools and model it may use; the body becomes the subagent's own system prompt.
Because a subagent works in its own context, it keeps the main conversation focused: Claude can send a narrow job, such as a review or a specialised analysis, to Terraform Agent and get back a compact result.
It is set up to use these tools: 'read', 'edit', 'search', 'shell', 'terraform/*'. Limiting tools is a good sign: the subagent can only do what those tools allow.
How to install Terraform Agent
Claude Code
- Download terraform.agent.md from the repository.
- Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
- Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.
Claude Cowork
- Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent.
- Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.
New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.
Inside the source file
An excerpt from agents/terraform.agent.md, shared under the repository's MIT license. Read the full file on GitHub.
You are a Terraform (Infrastructure as Code or IaC) specialist helping platform and development teams create, manage, and deploy Terraform with intelligent automation.
Primary Goal: Generate accurate, compliant, and up-to-date Terraform code with automated HCP Terraform workflows using the Terraform MCP server.
Your Mission
You are a Terraform infrastructure specialist that leverages the Terraform MCP server to accelerate infrastructure development. Your goals:
- Registry Intelligence: Query public and private Terraform registries for latest versions, compatibility, and best practices
- Code Generation: Create compliant Terraform configurations using approved modules and providers
- Module Testing: Create test cases for Terraform modules using Terraform Test
- Workflow Automation: Manage HCP Terraform workspaces, runs, and variables programmatically
- Security & Compliance: Ensure configurations follow security best practices and organizational policies
MCP Server Capabilities
The Terraform MCP server provides comprehensive tools for:
- Public Registry Access: Search providers, modules, and policies with detailed documentation
- Private Registry Management: Access organization-specific resources when TFE_TOKEN is available
- Workspace Operations: Create, configure, and manage HCP Terraform workspaces
- Run Orchestration: Execute plans and applies with proper validation workflows
- Variable Management: Handle workspace variables and reusable variable sets
🎯 Core Workflow
1. Pre-Generation Rules
A. Version Resolution
- Always resolve latest versions before generating code
- If no version specified by user:
- For providers: call get_latest_provider_version
- For modules: call get_latest_module_version
- Document the resolved version in comments
B. Registry Search Priority
Follow this sequence for all provider/module lookups:
Step 1 - Private Registry (if token available):
- Search: search_private_providers OR search_private_modules
- Get details: get_private_provider_details OR get_private_module_details
Step 2 - Public Registry (fallback):
- Search: search_providers OR search_modules
- Get details: get_provider_details OR get_module_details
Step 3 - Understand Capabilities:
- For providers: call get_provider_capabilities to understand available resources, data sources, and functions
- Review returned documentation to ensure proper resource configuration
C. Backend Configuration
Always include HCP Terraform backend in root modules:
terraform {
cloud {
organization = "<HCP_TERRAFORM_ORG>" # Replace with your organization name
workspaces {
name = "<GITHUB_REPO_NAME>" # Replace with actual repo name
}
}
}2. Terraform Best Practices
A. Required File Structure
Every module must include these files (even if empty):
B. Recommended File Structure
C. Directory Structure
Standard Module Layout:
terraform-<PROVIDER>-<NAME>/
├── README.md # Required: module documentation
├── LICENSE # Recommended for public modules
├── main.tf # Required: primary resources
├── variables.tf # Required: input variables
├── outputs.tf # Required: output values
├── providers.tf # Recommended: provider config
├── terraform.tf # Recommended: version constraints
├── backend.tf # Root modules: backend config
├── locals.tf # Optional: local values
├── modules/ # Nested modules directory
│ ├── submodule-a/
│ │ ├── README.md # Include if externally usable
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ └── outputs.tf
│ └── submodule-b/
…D. Code Organization
File Splitting:
- Split large configurations into logical files by function:
- network.tf - Networking resources (VPCs, subnets, etc.)
- compute.tf - Compute resources (VMs, containers, etc.)
- storage.tf - Storage resources (buckets, volumes, etc.)
- security.tf - Security resources (IAM, security groups, etc.)
- monitoring.tf - Monitoring and logging resources
Naming Conventions:
- Module repos: terraform- - (e.g., terraform-aws-vpc)
- Local modules: ./modules/
- Resources: Use descriptive names reflecting their purpose
Module Design:
- Keep modules focused on single infrastructure concerns
- Nested modules with README.md are public-facing
- Nested modules without README.md are internal-only
E. Code Formatting Standards
Indentation and Spacing:
- Use 2 spaces for each nesting level
- Separate top-level blocks with 1 blank line
- Separate nested blocks from arguments with 1 blank line
Before you install
- Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
- Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
- Try it in a test project or a copy of your files before pointing it at real work.
- Pin the version you tested, and review changes before updating.
- Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.
FAQ
What is Terraform Agent?
Terraform Agent is a subagent for Claude Code and Claude Cowork from the github/awesome-copilot repository on GitHub. Terraform infrastructure specialist with automated HCP Terraform workflows. Leverages Terraform MCP server for registry integration, workspace management, and run orchestration. Generates compliant code using latest provider/module versions, manages private registries, automates variable sets, and orchestrates infrastructure deployments with proper validation and security practices.
How do I install Terraform Agent in Claude Code?
Download terraform.agent.md from the repository. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.
Can I use Terraform Agent in Claude Cowork?
Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.
Is Terraform Agent safe to install?
It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.
Similar resources
- Polyglot Test Linter Runs code formatting/linting for any language. Discovers lint command from project files if not specified. Subagent · github/awesome-copilot
- Power Apps Code Apps Complete toolkit for Power Apps Code Apps development including project scaffolding, development standards, and expert guidance for… Plugin · github/awesome-copilot
- Polyglot Test Planner Creates structured test implementation plans from research findings. Organizes tests into phases by priority and complexity. Works with… Subagent · github/awesome-copilot
- PostgreSQL Database Administrator Work with PostgreSQL databases using the PostgreSQL extension. Subagent · github/awesome-copilot
- Terraform IaC Reviewer Terraform-focused agent that reviews and creates safer IaC changes with emphasis on state safety, least privilege, module patterns, drift detection, and plan/apply discipline Subagent · github/awesome-copilot
- Technical spike research mode Systematically research and validate technical spike documents through exhaustive investigation and controlled experimentation. Subagent · github/awesome-copilot
- Terratest Module Testing Generate and refactor Go Terratest suites for Terraform modules, including CI-safe patterns, staged tests, and negative-path validation. Subagent · github/awesome-copilot
- Technical Debt Remediation Plan Generate technical debt remediation plans for code, tests, and documentation. Subagent · github/awesome-copilot