Hashicorp Terraform

Hashicorp Terraform

The Terraform MCP Server provides seamless integration with Terraform ecosystem, enabling advanced automation and interaction capabilities for Infrastructure as Code (IaC) development.

8 Tools

Add to Docker Desktop

Version 4.43 or later needs to be installed to add the server automatically

Use cases

About

Hashicorp Terraform MCP Server

The Terraform MCP Server provides seamless integration with Terraform ecosystem, enabling advanced automation and interaction capabilities for Infrastructure as Code (IaC) development.

What is an MCP Server?

MCP Info

Image Building InfoDockerfile|https://github.com/hashicorp/terraform-mcp-server/blob/main/Dockerfile

Docker Image built by|hashicorp Docker Scout Health Score|Not available Verify Signature|Not available Licence|Mozilla Public License 2.0

Available Tools (8)

Tools provided by this ServerShort Description
get_latest_module_versionGet Latest Module Version
get_latest_provider_versionGet Latest Provider Version
get_module_detailsRetrieve documentation for a specific Terraform module
get_policy_detailsFetch detailed Terraform policy documentation using a terraform_policy_id
get_provider_detailsFetch detailed Terraform provider documentation using a document ID
search_modulesSearch and match Terraform modules based on name and relevance
search_policiesSearch and match Terraform policies based on name and relevance
search_providersIdentify the most relevant provider document ID for a Terraform service

Tools Details

Tool: get_latest_module_version

Fetches the latest version of a Terraform module from the public registry

ParametersTypeDescription
module_namestringThe 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_providerstringThe name of the Terraform provider for the module, e.g., 'aws', 'google', 'azurerm' etc.
module_publisherstringThe 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.


Tool: get_latest_provider_version

Fetches the latest version of a Terraform provider from the public registry

ParametersTypeDescription
namestringThe name of the Terraform provider, e.g., 'aws', 'azurerm', 'google', etc.
namespacestringThe 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.


Tool: 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.

ParametersTypeDescription
module_idstringExact 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.


Tool: 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.

ParametersTypeDescription
terraform_policy_idstringMatching 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.


Tool: 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.

ParametersTypeDescription
provider_doc_idstringExact 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.


Tool: 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.

ParametersTypeDescription
module_querystringThe query to search for Terraform modules.
current_offsetnumberoptionalCurrent offset for pagination

This tool is read-only. It does not modify its environment.

This tool interacts with external entities.


Tool: 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.

ParametersTypeDescription
policy_querystringThe query to search for Terraform modules.

This tool is read-only. It does not modify its environment.

This tool interacts with external entities.


Tool: 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.

ParametersTypeDescription
provider_document_typestringThe 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_namestringThe name of the Terraform provider to perform the read or deployment operation
provider_namespacestringThe publisher of the Terraform provider, typically the name of the company, or their GitHub organization name that created the provider
service_slugstringThe 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_versionstringoptionalThe 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.


Use this MCP Server

{
  "mcpServers": {
    "terraform": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "hashicorp/terraform-mcp-server"
      ]
    }
  }
}

Why is it safer to run MCP Servers with Docker?

Manual installation

You can install the MCP server using:

Installation for

Related servers