Skip to main content
Glama

get_plan_json_output

Retrieve a machine-readable JSON execution plan from Terraform Cloud, detailing resource changes and planned actions for infrastructure management.

Instructions

Retrieve the JSON execution plan.

Gets the JSON representation of a plan's execution details, providing a machine-readable format of the planned resource changes.

API endpoint: GET /plans/{plan_id}/json-output

Args: plan_id: The ID of the plan to retrieve JSON output for (format: "plan-xxxxxxxx")

Returns: The complete JSON formatted plan with resource changes, metadata, and planned actions. The redirect is automatically followed.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
plan_idYes

Implementation Reference

  • The handler function that executes the tool logic: validates input using PlanJsonOutputRequest, then fetches JSON plan output from Terraform Cloud API endpoint /plans/{plan_id}/json-output.
    @handle_api_errors async def get_plan_json_output(plan_id: str) -> APIResponse: """Retrieve the JSON execution plan. Gets the JSON representation of a plan's execution details, providing a machine-readable format of the planned resource changes. API endpoint: GET /plans/{plan_id}/json-output Args: plan_id: The ID of the plan to retrieve JSON output for (format: "plan-xxxxxxxx") Returns: The complete JSON formatted plan with resource changes, metadata, and planned actions. The redirect is automatically followed. See: docs/tools/plan.md for reference documentation """ # Validate parameters params = PlanJsonOutputRequest(plan_id=plan_id) # Make API request return await api_request(f"plans/{params.plan_id}/json-output")
  • Pydantic input schema model PlanJsonOutputRequest that validates the required plan_id parameter with pattern matching for Terraform plan IDs.
    class PlanJsonOutputRequest(APIRequest): """Request model for retrieving a plan's JSON output. Used to validate the plan ID parameter for JSON output API requests. Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/plans#retrieve-the-json-execution-plan See: docs/models/plan.md for reference """ plan_id: str = Field( ..., # No alias needed as field name matches API parameter description="The ID of the plan to retrieve JSON output for", pattern=r"^plan-[a-zA-Z0-9]{16}$", # Standard plan ID pattern )
  • Tool registration in the FastMCP server using mcp.tool() decorator applied to the imported plans.get_plan_json_output function.
    mcp.tool()(plans.get_plan_json_output)

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