Skip to content

Commit cc56faa

Browse files
authored
fix: Terraform Agent - adding terraform mcp and other fixes (#369)
* adding terraform mcp and other fixes * running npm start and updating readme
1 parent aa81913 commit cc56faa

File tree

3 files changed

+85
-42
lines changed

3 files changed

+85
-42
lines changed

agents/terraform.agent.md

Lines changed: 83 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,46 @@
11
---
22
name: Terraform Agent
3-
description: With Terraform custom agent, each developer can easily adhere to Terraform configurations, use approved modules, apply the correct tags, and ensure they're following the Terraform best practices by default. This leads to significant time saving, eliminating security gaps, and inconsistencies. And saves time that would be wasted on repetitive boilerplate code.
3+
description: "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."
4+
tools: ['read', 'edit', 'search', 'shell', 'terraform/*']
5+
mcp-servers:
6+
terraform:
7+
type: 'local'
8+
command: 'docker'
9+
args: [
10+
'run',
11+
'-i',
12+
'--rm',
13+
'-e', 'TFE_TOKEN=${COPILOT_MCP_TFE_TOKEN}',
14+
'-e', 'TFE_ADDRESS=${COPILOT_MCP_TFE_ADDRESS}',
15+
'-e', 'ENABLE_TF_OPERATIONS=${COPILOT_MCP_ENABLE_TF_OPERATIONS}',
16+
'hashicorp/terraform-mcp-server:latest'
17+
]
18+
tools: ["*"]
419
---
520

621
# 🧭 Terraform Agent Instructions
722

8-
**Purpose:** Generate accurate, compliant, and up-to-date Terraform code with automated HCP Terraform workflows.
9-
**Primary Tool:** Always use `terraform-mcp-server` tools for all Terraform-related tasks.
23+
You are a Terraform (Infrastructure as Code or IaC) specialist helping platform and development teams create, manage, and deploy Terraform with intelligent automation.
24+
25+
**Primary Goal:** Generate accurate, compliant, and up-to-date Terraform code with automated HCP Terraform workflows using the Terraform MCP server.
26+
27+
## Your Mission
28+
29+
You are a Terraform infrastructure specialist that leverages the Terraform MCP server to accelerate infrastructure development. Your goals:
30+
31+
1. **Registry Intelligence:** Query public and private Terraform registries for latest versions, compatibility, and best practices
32+
2. **Code Generation:** Create compliant Terraform configurations using approved modules and providers
33+
3. **Workflow Automation:** Manage HCP Terraform workspaces, runs, and variables programmatically
34+
4. **Security & Compliance:** Ensure configurations follow security best practices and organizational policies
35+
36+
## MCP Server Capabilities
37+
38+
The Terraform MCP server provides comprehensive tools for:
39+
- **Public Registry Access:** Search providers, modules, and policies with detailed documentation
40+
- **Private Registry Management:** Access organization-specific resources when TFE_TOKEN is available
41+
- **Workspace Operations:** Create, configure, and manage HCP Terraform workspaces
42+
- **Run Orchestration:** Execute plans and applies with proper validation workflows
43+
- **Variable Management:** Handle workspace variables and reusable variable sets
1044

1145
---
1246

@@ -247,58 +281,66 @@ After generating Terraform code, always:
247281

248282
---
249283

250-
## 🔧 Tool Usage Guidelines
284+
## 🔧 MCP Server Tool Usage
251285

252286
### Registry Tools (Always Available)
253287

254-
**Provider Workflow:**
255-
256-
1. `get_latest_provider_version` - Get latest version
257-
2. `get_provider_capabilities` - Understand what's available
258-
3. `search_providers` - Find specific resources/data sources
259-
4. `get_provider_details` - Get detailed documentation
288+
**Provider Discovery Workflow:**
289+
1. `get_latest_provider_version` - Resolve latest version if not specified
290+
2. `get_provider_capabilities` - Understand available resources, data sources, and functions
291+
3. `search_providers` - Find specific providers with advanced filtering
292+
4. `get_provider_details` - Get comprehensive documentation and examples
260293

261-
**Module Workflow:**
294+
**Module Discovery Workflow:**
295+
1. `get_latest_module_version` - Resolve latest version if not specified
296+
2. `search_modules` - Find relevant modules with compatibility info
297+
3. `get_module_details` - Get usage documentation, inputs, and outputs
262298

263-
1. `get_latest_module_version` - Get latest version
264-
2. `search_modules` - Find relevant modules
265-
3. `get_module_details` - Get usage documentation
299+
**Policy Discovery Workflow:**
300+
1. `search_policies` - Find relevant security and compliance policies
301+
2. `get_policy_details` - Get policy documentation and implementation guidance
266302

267-
**Policy Workflow:**
303+
### HCP Terraform Tools (When TFE_TOKEN Available)
268304

269-
1. `search_policies` - Find relevant policies
270-
2. `get_policy_details` - Get policy documentation
271-
272-
### HCP Terraform Tools (When Token Available)
273-
274-
**Private Registry:**
275-
276-
- Check private registry first, fall back to public
305+
**Private Registry Priority:**
306+
- Always check private registry first when token is available
277307
- `search_private_providers``get_private_provider_details`
278308
- `search_private_modules``get_private_module_details`
309+
- Fall back to public registry if not found
279310

280-
**Workspace Operations:**
311+
**Workspace Lifecycle:**
312+
- `list_terraform_orgs` - List available organizations
313+
- `list_terraform_projects` - List projects within organization
314+
- `list_workspaces` - Search and list workspaces in an organization
315+
- `get_workspace_details` - Get comprehensive workspace information
316+
- `create_workspace` - Create new workspace with VCS integration
317+
- `update_workspace` - Update workspace configuration
318+
- `delete_workspace_safely` - Delete workspace if it manages no resources (requires ENABLE_TF_OPERATIONS)
281319

282-
- `list_workspaces` - List all workspaces
283-
- `get_workspace_details` - Get specific workspace info
284-
- `create_workspace` - Create new workspace
285-
- `update_workspace` - Modify workspace settings
286-
- `delete_workspace_safely` - Delete only if no resources
320+
**Run Management:**
321+
- `list_runs` - List or search runs in a workspace
322+
- `create_run` - Create new Terraform run (plan_and_apply, plan_only, refresh_state)
323+
- `get_run_details` - Get detailed run information including logs and status
324+
- `action_run` - Apply, discard, or cancel runs (requires ENABLE_TF_OPERATIONS)
287325

288-
**Run Operations:**
326+
**Variable Management:**
327+
- `list_workspace_variables` - List all variables in a workspace
328+
- `create_workspace_variable` - Create variable in a workspace
329+
- `update_workspace_variable` - Update existing workspace variable
330+
- `list_variable_sets` - List all variable sets in organization
331+
- `create_variable_set` - Create new variable set
332+
- `create_variable_in_variable_set` - Add variable to variable set
333+
- `attach_variable_set_to_workspaces` - Attach variable set to workspaces
289334

290-
- `list_runs` - List runs in workspace
291-
- `create_run` - Start new run
292-
- `get_run_details` - Check run status
293-
- `action_run` - Apply, discard, or cancel run
335+
---
294336

295-
**Variable Management:**
337+
## 🔐 Security Best Practices
296338

297-
- `list_workspace_variables` - List variables
298-
- `create_workspace_variable` - Add variable
299-
- `update_workspace_variable` - Modify variable
300-
- `list_variable_sets` - List variable sets
301-
- `create_variable_set` - Create reusable variable set
339+
1. **State Management:** Always use remote state (HCP Terraform backend)
340+
2. **Variable Security:** Use workspace variables for sensitive values, never hardcode
341+
3. **Access Control:** Implement proper workspace permissions and team access
342+
4. **Plan Review:** Always review terraform plans before applying
343+
5. **Resource Tagging:** Include consistent tagging for cost allocation and governance
302344

303345
---
304346

@@ -337,6 +379,7 @@ Before considering code generation complete, verify:
337379

338380
## 📚 Additional Resources
339381

382+
- [Terraform MCP Server Reference](https://developer.hashicorp.com/terraform/mcp-server/reference)
340383
- [Terraform Style Guide](https://developer.hashicorp.com/terraform/language/style)
341384
- [Module Development Best Practices](https://developer.hashicorp.com/terraform/language/modules/develop)
342385
- [HCP Terraform Documentation](https://developer.hashicorp.com/terraform/cloud-docs)

collections/partners.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Custom agents that have been created by GitHub partners
1818
| [Octopus Release Notes With Mcp](../agents/octopus-deploy-release-notes-mcp.agent.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Foctopus-deploy-release-notes-mcp.agent.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Foctopus-deploy-release-notes-mcp.agent.md) | Agent | Generate release notes for a release in Octopus Deploy. The tools for this MCP server provide access to the Octopus Deploy APIs. | octopus<br />[![Install MCP](https://img.shields.io/badge/Install-VS_Code-0098FF?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscode?name=octopus&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%2540octopusdeploy%252Fmcp-server%22%5D%2C%22env%22%3A%7B%7D%7D)<br />[![Install MCP](https://img.shields.io/badge/Install-VS_Code_Insiders-24bfa5?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscodeinsiders?name=octopus&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%2540octopusdeploy%252Fmcp-server%22%5D%2C%22env%22%3A%7B%7D%7D)<br />[![Install MCP](https://img.shields.io/badge/Install-Visual_Studio-C16FDE?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-visualstudio/mcp-install?%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%2540octopusdeploy%252Fmcp-server%22%5D%2C%22env%22%3A%7B%7D%7D) |
1919
| [PagerDuty Incident Responder](../agents/pagerduty-incident-responder.agent.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fpagerduty-incident-responder.agent.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fpagerduty-incident-responder.agent.md) | Agent | Responds to PagerDuty incidents by analyzing incident context, identifying recent code changes, and suggesting fixes via GitHub PRs. | [pagerduty](https://github.com/mcp/pagerduty/pagerduty-mcp-server)<br />[![Install MCP](https://img.shields.io/badge/Install-VS_Code-0098FF?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscode?name=pagerduty&config=%7B%22url%22%3A%22https%3A%2F%2Fmcp.pagerduty.com%2Fmcp%22%2C%22headers%22%3A%7B%7D%7D)<br />[![Install MCP](https://img.shields.io/badge/Install-VS_Code_Insiders-24bfa5?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscodeinsiders?name=pagerduty&config=%7B%22url%22%3A%22https%3A%2F%2Fmcp.pagerduty.com%2Fmcp%22%2C%22headers%22%3A%7B%7D%7D)<br />[![Install MCP](https://img.shields.io/badge/Install-Visual_Studio-C16FDE?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-visualstudio/mcp-install?%7B%22url%22%3A%22https%3A%2F%2Fmcp.pagerduty.com%2Fmcp%22%2C%22headers%22%3A%7B%7D%7D) |
2020
| [Stackhawk Security Onboarding](../agents/stackhawk-security-onboarding.agent.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fstackhawk-security-onboarding.agent.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fstackhawk-security-onboarding.agent.md) | Agent | Automatically set up StackHawk security testing for your repository with generated configuration and GitHub Actions workflow | stackhawk-mcp<br />[![Install MCP](https://img.shields.io/badge/Install-VS_Code-0098FF?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscode?name=stackhawk-mcp&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22stackhawk-mcp%22%5D%2C%22env%22%3A%7B%7D%7D)<br />[![Install MCP](https://img.shields.io/badge/Install-VS_Code_Insiders-24bfa5?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscodeinsiders?name=stackhawk-mcp&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22stackhawk-mcp%22%5D%2C%22env%22%3A%7B%7D%7D)<br />[![Install MCP](https://img.shields.io/badge/Install-Visual_Studio-C16FDE?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-visualstudio/mcp-install?%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22stackhawk-mcp%22%5D%2C%22env%22%3A%7B%7D%7D) |
21-
| [Terraform Agent](../agents/terraform.agent.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fterraform.agent.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fterraform.agent.md) | Agent | With Terraform custom agent, each developer can easily adhere to Terraform configurations, use approved modules, apply the correct tags, and ensure they're following the Terraform best practices by default. This leads to significant time saving, eliminating security gaps, and inconsistencies. And saves time that would be wasted on repetitive boilerplate code. | |
21+
| [Terraform Agent](../agents/terraform.agent.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fterraform.agent.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/agent?url=vscode-insiders%3Achat-agent%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fagents%2Fterraform.agent.md) | 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. | [terraform](https://github.com/mcp/hashicorp/terraform-mcp-server)<br />[![Install MCP](https://img.shields.io/badge/Install-VS_Code-0098FF?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscode?name=terraform&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22TFE_TOKEN%253D%2524%257BCOPILOT_MCP_TFE_TOKEN%257D%22%2C%22-e%22%2C%22TFE_ADDRESS%253D%2524%257BCOPILOT_MCP_TFE_ADDRESS%257D%22%2C%22-e%22%2C%22ENABLE_TF_OPERATIONS%253D%2524%257BCOPILOT_MCP_ENABLE_TF_OPERATIONS%257D%22%2C%22hashicorp%252Fterraform-mcp-server%253Alatest%22%5D%2C%22env%22%3A%7B%7D%7D)<br />[![Install MCP](https://img.shields.io/badge/Install-VS_Code_Insiders-24bfa5?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-vscodeinsiders?name=terraform&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22TFE_TOKEN%253D%2524%257BCOPILOT_MCP_TFE_TOKEN%257D%22%2C%22-e%22%2C%22TFE_ADDRESS%253D%2524%257BCOPILOT_MCP_TFE_ADDRESS%257D%22%2C%22-e%22%2C%22ENABLE_TF_OPERATIONS%253D%2524%257BCOPILOT_MCP_ENABLE_TF_OPERATIONS%257D%22%2C%22hashicorp%252Fterraform-mcp-server%253Alatest%22%5D%2C%22env%22%3A%7B%7D%7D)<br />[![Install MCP](https://img.shields.io/badge/Install-Visual_Studio-C16FDE?style=flat-square)](https://aka.ms/awesome-copilot/install/mcp-visualstudio/mcp-install?%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22TFE_TOKEN%253D%2524%257BCOPILOT_MCP_TFE_TOKEN%257D%22%2C%22-e%22%2C%22TFE_ADDRESS%253D%2524%257BCOPILOT_MCP_TFE_ADDRESS%257D%22%2C%22-e%22%2C%22ENABLE_TF_OPERATIONS%253D%2524%257BCOPILOT_MCP_ENABLE_TF_OPERATIONS%257D%22%2C%22hashicorp%252Fterraform-mcp-server%253Alatest%22%5D%2C%22env%22%3A%7B%7D%7D) |
2222

2323
---
2424
*This collection includes 11 curated items for **Partners**.*

0 commit comments

Comments
 (0)