Skip to main content
Glama
severity1

terraform-cloud-mcp

unassign_variable_set_from_projects

Remove a variable set from Terraform Cloud projects to stop variables from being available in their workspaces.

Instructions

Remove a variable set from one or more projects.

Removes the variable set assignment from the specified projects. The variables will no longer be available in workspaces within those projects.

API endpoint: DELETE /varsets/{varset_id}/relationships/projects

Args: varset_id: The ID of the variable set (format: "varset-xxxxxxxx") project_ids: List of project IDs (format: ["prj-xxxxxxxx", ...])

Returns: Empty response with HTTP 204 status code if successful

See: docs/tools/variables.md#unassign-variable-set-from-projects for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
varset_idYes
project_idsYes

Implementation Reference

  • The main handler function that unassigns a variable set from specified projects by sending a DELETE request to the Terraform Cloud API's relationships/projects endpoint with the list of project IDs.
    @handle_api_errors
    async def unassign_variable_set_from_projects(
        varset_id: str, project_ids: List[str]
    ) -> APIResponse:
        """Remove a variable set from one or more projects.
    
        Removes the variable set assignment from the specified projects. The variables
        will no longer be available in workspaces within those projects.
    
        API endpoint: DELETE /varsets/{varset_id}/relationships/projects
    
        Args:
            varset_id: The ID of the variable set (format: "varset-xxxxxxxx")
            project_ids: List of project IDs (format: ["prj-xxxxxxxx", ...])
    
        Returns:
            Empty response with HTTP 204 status code if successful
    
        See:
            docs/tools/variables.md#unassign-variable-set-from-projects for reference documentation
        """
        # Build relationships payload
        relationships_data = []
        for project_id in project_ids:
            relationships_data.append({"type": "projects", "id": project_id})
    
        payload = {"data": relationships_data}
        endpoint = f"varsets/{varset_id}/relationships/projects"
        return await api_request(endpoint, method="DELETE", data=payload)
  • Registers the unassign_variable_set_from_projects tool function from the variables module using FastMCP's mcp.tool decorator with write_tool_config (enabled unless read-only mode).
    mcp.tool(**write_tool_config)(variables.unassign_variable_set_from_projects)

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