Skip to main content
Glama

get_errored_state

Retrieve failed Terraform state files from Terraform Cloud to recover data after apply errors. Access state information when uploads fail during infrastructure deployment.

Instructions

Retrieve the errored state from a failed apply.

Gets information about a state file that failed to upload during an apply, providing access to the state data for recovery purposes.

API endpoint: GET /applies/{apply_id}/errored-state

Args: apply_id: The ID of the apply with a failed state upload (format: "apply-xxxxxxxx")

Returns: Information about the errored state including access details. The redirect to the state file is automatically followed.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apply_idYes

Implementation Reference

  • The main handler function that implements the tool logic: retrieves errored state from a failed Terraform Cloud apply by calling the API endpoint /applies/{apply_id}/errored-state, with input validation using ApplyErroredStateRequest model.
    @handle_api_errors async def get_errored_state(apply_id: str) -> APIResponse: """Retrieve the errored state from a failed apply. Gets information about a state file that failed to upload during an apply, providing access to the state data for recovery purposes. API endpoint: GET /applies/{apply_id}/errored-state Args: apply_id: The ID of the apply with a failed state upload (format: "apply-xxxxxxxx") Returns: Information about the errored state including access details. The redirect to the state file is automatically followed. See: docs/tools/apply.md for reference documentation """ # Validate parameters params = ApplyErroredStateRequest(apply_id=apply_id) # Make API request - redirect handling happens automatically in the API client return await api_request(f"applies/{params.apply_id}/errored-state")
  • The tool registration line in the MCP server, applying the mcp.tool() decorator to the imported get_errored_state function from the applies module.
    mcp.tool()(applies.get_errored_state)

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