Terraform
Terraform MCP server overview
This topic provides an overview of the Terraform model context protocol (MCP) server, which helps you write Terraform configuration using an AI or LLM. The server requests information directly from the Terraform registry so that your model can formulate responses using provider code and documentation as the source of truth.
Note
This feature is currently in beta. Do not use beta functionality in production environments.
Introduction
MCP standardizes how AI models can discover and interact with external tools, applications, and data sources. You can configure MCP clients, such as an AI or LLM chat, to send requests through an MCP server so that the model can provide answers to prompts that it may not have been trained on. Refer to the MCP documentation for details about how MCP works.
You can configure your AI model to connect to the Terraform MCP server so that it can request information about providers, modules, and other objects from data stored in the Terraform registry. When the Terraform MCP is available to your AI client, the model retrieves information from the most up-to-date source code stored in the registry, instead of relying on outdated training data. As a result, you can get more accurate and actionable information.
Note that to use the server, your questions must pertain to provider configuration from the registry. The LLM uses other sources, such as content from the internet, to respond to general questions about Terraform configuration or requests to generate code.
Workflow
Terraform MCP server tools
The Terraform MCP server runs in a Docker container on your local workstation and exposes functionality to clients using tools. The Terraform MCP server includes a set of tools that retrieve different types of information from the Terraform registry:
resolveProviderDocID
: Queries the Terraform Registry to find and list available documentation for a specific provider. This tool usesserviceSlug
to return a list of provider document IDs with their titles and categories for resources, data sources, functions, or guides.getProviderDocs
: Fetches the complete documentation content for a specific provider resource, data source, or function using a document ID obtained from theresolveProviderDocID
tool. Returns the raw documentation in markdown format.searchModules
: Searches the Terraform Registry for modules based on the specifiedmoduleQuery
with pagination. Returns a list of module IDs with their names, descriptions, download counts, verification status, and publish dates.moduleDetails
: Retrieves detailed documentation for a module using a module ID obtained from thesearchModules
tool, including inputs, outputs, configuration, submodules, and examples.
Provide feedback
We want to hear from you. Complete the Terraform MCP server feedback form to provide to help us improve this feature.