Skip to main content
Glama

assign_variable_set_to_projects

Apply variable sets to Terraform Cloud projects to make variables available across all workspaces within those projects.

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
varset_idYes
project_idsYes

Implementation Reference

  • The handler function that implements the tool logic: assigns a variable set to projects by POSTing relationships to the Terraform Cloud API endpoint.
    @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 in the MCP server with write permissions configuration.
    mcp.tool(**write_tool_config)(variables.assign_variable_set_to_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