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
| Name | Required | Description | Default |
|---|---|---|---|
| varset_id | Yes | ||
| project_ids | Yes |
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)
- terraform_cloud_mcp/server.py:139-139 (registration)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)