Skip to main content
Glama

assign_variable_set_to_projects

Assign a variable set to multiple projects to make variables available across all workspaces within those projects. Streamlines variable management in Terraform Cloud.

Instructions

Assign a variable set to one or more projects.

Makes the variables in a variable set available to all workspaces within the specified projects.

API endpoint: POST /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#assign-variable-set-to-projects for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idsYes
varset_idYes

Implementation Reference

  • The main handler function decorated with @handle_api_errors that implements the tool: assigns a variable set to specified projects by making a POST request to the Terraform Cloud API with the project relationships payload.
    @handle_api_errors async def assign_variable_set_to_projects( varset_id: str, project_ids: List[str] ) -> APIResponse: """Assign a variable set to one or more projects. Makes the variables in a variable set available to all workspaces within the specified projects. API endpoint: POST /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#assign-variable-set-to-projects for reference documentation """ # Build relationships payload relationships_data = [] for project_id in project_ids: relationships_data.append({"id": project_id, "type": "projects"}) payload = {"data": relationships_data} endpoint = f"varsets/{varset_id}/relationships/projects" return await api_request(endpoint, method="POST", data=payload)
  • Registers the 'assign_variable_set_to_projects' tool using the mcp.tool decorator with write_tool_config, likely enabling write permissions.
    mcp.tool(**write_tool_config)(variables.assign_variable_set_to_projects)

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