unassign_variable_set_from_projects
Remove a variable set from specified Terraform Cloud projects to stop its variables from being available in associated workspaces. Uses the DELETE /varsets/{varset_id}/relationships/projects API endpoint for execution.
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 |
|---|---|---|---|
| project_ids | Yes | ||
| varset_id | Yes |
Implementation Reference
- The core handler function that executes the tool: sends a DELETE request to unassign the variable set from the given projects.@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 tool in the MCP server using mcp.tool decorator.mcp.tool(**write_tool_config)(variables.unassign_variable_set_from_projects)