The Terraform MCP Server provides seamless integration with Terraform ecosystem, enabling advanced automation and interaction capabilities for Infrastructure as Code (IaC) development.
8 Tools
Version 4.43 or later needs to be installed to add the server automatically
Use cases
About
The Terraform MCP Server provides seamless integration with Terraform ecosystem, enabling advanced automation and interaction capabilities for Infrastructure as Code (IaC) development.
Attribute | Details |
---|---|
Docker Image | hashicorp/terraform-mcp-server |
Author | hashicorp |
Repository | https://github.com/hashicorp/terraform-mcp-server |
Docker Image built by|hashicorp Docker Scout Health Score|Not available Verify Signature|Not available Licence|Mozilla Public License 2.0
Tools provided by this Server | Short Description |
---|---|
get_latest_module_version | Get Latest Module Version |
get_latest_provider_version | Get Latest Provider Version |
get_module_details | Retrieve documentation for a specific Terraform module |
get_policy_details | Fetch detailed Terraform policy documentation using a terraform_policy_id |
get_provider_details | Fetch detailed Terraform provider documentation using a document ID |
search_modules | Search and match Terraform modules based on name and relevance |
search_policies | Search and match Terraform policies based on name and relevance |
search_providers | Identify the most relevant provider document ID for a Terraform service |
get_latest_module_version
Fetches the latest version of a Terraform module from the public registry
Parameters | Type | Description |
---|---|---|
module_name | string | The name of the module, this is usually the service or group of service the user is deploying e.g., 'security-group', 'secrets-manager' etc. |
module_provider | string | The name of the Terraform provider for the module, e.g., 'aws', 'google', 'azurerm' etc. |
module_publisher | string | The publisher of the module, e.g., 'hashicorp', 'aws-ia', 'terraform-google-modules', 'Azure' etc. |
This tool is read-only. It does not modify its environment.
This tool interacts with external entities.
get_latest_provider_version
Fetches the latest version of a Terraform provider from the public registry
Parameters | Type | Description |
---|---|---|
name | string | The name of the Terraform provider, e.g., 'aws', 'azurerm', 'google', etc. |
namespace | string | The namespace of the Terraform provider, typically the name of the company, or their GitHub organization name that created the provider e.g., 'hashicorp' |
This tool is read-only. It does not modify its environment.
This tool interacts with external entities.
get_module_details
Fetches up-to-date documentation on how to use a Terraform module. You must call 'search_modules' first to obtain the exact valid and compatible module_id required to use this tool.
Parameters | Type | Description |
---|---|---|
module_id | string | Exact valid and compatible module_id retrieved from search_modules (e.g., 'squareops/terraform-kubernetes-mongodb/mongodb/2.1.1', 'GoogleCloudPlatform/vertex-ai/google/0.2.0') |
This tool is read-only. It does not modify its environment.
This tool interacts with external entities.
get_policy_details
Fetches up-to-date documentation for a specific policy from the Terraform registry. You must call 'search_policies' first to obtain the exact terraform_policy_id required to use this tool.
Parameters | Type | Description |
---|---|---|
terraform_policy_id | string | Matching terraform_policy_id retrieved from the 'search_policies' tool (e.g., 'policies/hashicorp/CIS-Policy-Set-for-AWS-Terraform/1.0.1') |
This tool is read-only. It does not modify its environment.
This tool interacts with external entities.
get_provider_details
Fetches up-to-date documentation for a specific service from a Terraform provider. You must call 'search_providers' tool first to obtain the exact tfprovider-compatible provider_doc_id required to use this tool.
Parameters | Type | Description |
---|---|---|
provider_doc_id | string | Exact tfprovider-compatible provider_doc_id, (e.g., '8894603', '8906901') retrieved from 'search_providers' |
This tool is read-only. It does not modify its environment.
This tool interacts with external entities.
search_modules
Resolves a Terraform module name to obtain a compatible module_id for the get_module_details tool and returns a list of matching Terraform modules. You MUST call this function before 'get_module_details' to obtain a valid and compatible module_id. When selecting the best match, consider the following: - Name similarity to the query - Description relevance - Verification status (verified) - Download counts (popularity) Return the selected module_id and explain your choice. If there are multiple good matches, mention this but proceed with the most relevant one. If no modules were found, reattempt the search with a new moduleName query.
Parameters | Type | Description |
---|---|---|
module_query | string | The query to search for Terraform modules. |
current_offset | number optional | Current offset for pagination |
This tool is read-only. It does not modify its environment.
This tool interacts with external entities.
search_policies
Searches for Terraform policies based on a query string. This tool returns a list of matching policies, which can be used to retrieve detailed policy information using the 'get_policy_details' tool. You MUST call this function before 'get_policy_details' to obtain a valid terraform_policy_id. When selecting the best match, consider the following: - Name similarity to the query - Title relevance - Verification status (verified) - Download counts (popularity) Return the selected policyID and explain your choice. If there are multiple good matches, mention this but proceed with the most relevant one. If no policies were found, reattempt the search with a new policy_query.
Parameters | Type | Description |
---|---|---|
policy_query | string | The query to search for Terraform modules. |
This tool is read-only. It does not modify its environment.
This tool interacts with external entities.
search_providers
This tool retrieves a list of potential documents based on the 'service_slug' and 'provider_document_type' provided. You MUST call this function before 'get_provider_details' to obtain a valid tfprovider-compatible 'provider_doc_id'. Use the most relevant single word as the search query for 'service_slug', if unsure about the 'service_slug', use the 'provider_name' for its value. When selecting the best match, consider the following: - Title similarity to the query - Category relevance Return the selected 'provider_doc_id' and explain your choice. If there are multiple good matches, mention this but proceed with the most relevant one.
Parameters | Type | Description |
---|---|---|
provider_document_type | string | The type of the document to retrieve, |
for general overview of the provider use 'overview', | ||
for guidance on upgrading a provider or custom configuration information use 'guides', | ||
for deploying resources use 'resources', for reading pre-deployed resources use 'data-sources', | ||
for functions use 'functions', | ||
for Terraform actions use 'actions' | ||
provider_name | string | The name of the Terraform provider to perform the read or deployment operation |
provider_namespace | string | The publisher of the Terraform provider, typically the name of the company, or their GitHub organization name that created the provider |
service_slug | string | The slug of the service you want to deploy or read using the Terraform provider, prefer using a single word, use underscores for multiple words and if unsure about the service_slug, use the provider_name for its value |
provider_version | string optional | The version of the Terraform provider to retrieve in the format 'x.y.z', or 'latest' to get the latest version |
This tool is read-only. It does not modify its environment.
This tool interacts with external entities.
{
"mcpServers": {
"terraform": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"hashicorp/terraform-mcp-server"
]
}
}
}
Manual installation
You can install the MCP server using:
Installation for