Skip to main content
Glama

discard_run

Cancel a paused Terraform Cloud run without applying changes. Use this to remove undesired plans from the queue, unlock the workspace for new runs, and provide optional comments.

Instructions

Discard a run that is paused waiting for confirmation

Cancels a run without applying its changes, typically used when the plan shows undesired changes or after reviewing and rejecting a plan. This action removes the run from the queue and unlocks the workspace for new runs.

API endpoint: POST /runs/{run_id}/actions/discard

Args: run_id: The ID of the run to discard (format: "run-xxxxxxxx") comment: An optional explanation for why the run was discarded

Returns: Run status update with discarded state information, timestamp of the discard action, and user information

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commentNo
run_idYes

Implementation Reference

  • The main handler function for the 'discard_run' tool. It constructs a payload with an optional comment and sends a POST request to the Terraform Cloud API endpoint `/runs/{run_id}/actions/discard` to discard the specified run.
    @handle_api_errors async def discard_run(run_id: str, comment: str = "") -> APIResponse: """Discard a run that is paused waiting for confirmation Cancels a run without applying its changes, typically used when the plan shows undesired changes or after reviewing and rejecting a plan. This action removes the run from the queue and unlocks the workspace for new runs. API endpoint: POST /runs/{run_id}/actions/discard Args: run_id: The ID of the run to discard (format: "run-xxxxxxxx") comment: An optional explanation for why the run was discarded Returns: Run status update with discarded state information, timestamp of the discard action, and user information See: docs/tools/run.md for reference documentation """ request = RunActionRequest(run_id=run_id, comment=comment) # Create payload if comment is provided payload = {} if request.comment: payload = {"comment": request.comment} # Make API request return await api_request( f"runs/{run_id}/actions/discard", method="POST", data=payload )
  • Registration of the 'discard_run' tool in the MCP server using the FastMCP decorator with write configuration (enabled unless read-only mode).
    mcp.tool(**write_tool_config)(runs.discard_run)

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