Skip to main content
Glama

get_state_version

Retrieve detailed information about a specific Terraform state version, including status, download URLs, and resource metadata, for effective infrastructure management.

Instructions

Get details for a specific state version.

Retrieves comprehensive information about a state version including its status, download URLs, and resource information.

API endpoint: GET /state-versions/:state_version_id

Args: state_version_id: The ID of the state version to retrieve (format: "sv-xxxxxxxx")

Returns: State version details including status, timestamps, and resource metadata

See: docs/tools/state_versions.md for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
state_version_idYes

Implementation Reference

  • The primary handler function for the 'get_state_version' tool. It validates the state_version_id using Pydantic model and makes a GET request to the Terraform Cloud API endpoint /state-versions/:state_version_id to retrieve comprehensive state version details including status, download URLs, and metadata.
    @handle_api_errors async def get_state_version(state_version_id: str) -> APIResponse: """Get details for a specific state version. Retrieves comprehensive information about a state version including its status, download URLs, and resource information. API endpoint: GET /state-versions/:state_version_id Args: state_version_id: The ID of the state version to retrieve (format: "sv-xxxxxxxx") Returns: State version details including status, timestamps, and resource metadata See: docs/tools/state_versions.md for reference documentation """ # Validate parameters params = StateVersionRequest(state_version_id=state_version_id) # Make API request return await api_request(f"state-versions/{params.state_version_id}")
  • Registration of the 'get_state_version' tool using FastMCP's mcp.tool() decorator, importing the handler from tools/state_versions module.
    mcp.tool()(state_versions.get_state_version)
  • Pydantic model StateVersionRequest used for input validation of the state_version_id parameter (enforces sv-XXXXXXXXXXXXXXX format).
    class StateVersionRequest(APIRequest): """Request model for retrieving a state version. Used to validate the state version ID parameter for API requests. Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/state-versions See: docs/models/state_versions.md for reference """ state_version_id: str = Field( ..., description="The ID of the state version to retrieve", pattern=r"^sv-[a-zA-Z0-9]{16}$", # Standard state version ID pattern )
  • Import statement for the state_versions module containing the get_state_version handler, necessary for tool registration.
    from terraform_cloud_mcp.tools import state_versions

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/severity1/terraform-cloud-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server