Skip to main content
Glama

update_variable_set

Modify Terraform Cloud variable sets by updating specific attributes such as name, description, global scope, or priority. Use this tool to tailor variable configurations without altering unspecified settings.

Instructions

Update an existing variable set.

Modifies the settings of a variable set. Only specified attributes will be updated; unspecified attributes remain unchanged.

API endpoint: PATCH /varsets/{varset_id}

Args: varset_id: The ID of the variable set (format: "varset-xxxxxxxx")

params: Variable set parameters to update (optional): - name: New name for the variable set - description: New description of the variable set - global: Whether this is a global variable set - priority: Whether this variable set takes priority over workspace variables

Returns: The updated variable set with all current settings and configuration

See: docs/tools/variables.md#update-variable-set for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNo
varset_idYes

Implementation Reference

  • The main handler function for the update_variable_set tool. It updates a variable set via the Terraform Cloud API PATCH /varsets/{varset_id} endpoint using Pydantic models for validation.
    @handle_api_errors async def update_variable_set( varset_id: str, params: Optional[VariableSetParams] = None, ) -> APIResponse: """Update an existing variable set. Modifies the settings of a variable set. Only specified attributes will be updated; unspecified attributes remain unchanged. API endpoint: PATCH /varsets/{varset_id} Args: varset_id: The ID of the variable set (format: "varset-xxxxxxxx") params: Variable set parameters to update (optional): - name: New name for the variable set - description: New description of the variable set - global: Whether this is a global variable set - priority: Whether this variable set takes priority over workspace variables Returns: The updated variable set with all current settings and configuration See: docs/tools/variables.md#update-variable-set for reference documentation """ param_dict = params.model_dump(exclude_none=True) if params else {} request = VariableSetUpdateRequest(varset_id=varset_id, **param_dict) payload = create_api_payload( resource_type="varsets", model=request, exclude_fields={"varset_id"} ) return await api_request(f"varsets/{varset_id}", method="PATCH", data=payload)
  • Registers the update_variable_set function as an MCP tool with write permissions (not read-only).
    mcp.tool(**write_tool_config)(variables.update_variable_set)
  • Pydantic model defining the input parameters for updating a variable set, used for validation in the handler.
    class VariableSetParams(APIRequest): """Parameters for variable set operations without routing fields. This model provides all optional parameters for creating or updating variable sets, separating configuration parameters from routing information. Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/variable-sets See: docs/models/variables.md for reference """ name: Optional[str] = Field( None, description="Variable set name", min_length=1, max_length=90, ) description: Optional[str] = Field( None, description="Description of the variable set", max_length=512, ) global_: Optional[bool] = Field( None, alias="global", description="Whether this is a global variable set", ) priority: Optional[bool] = Field( None, description="Whether this variable set takes priority over workspace variables", )
  • Pydantic model for the full update request including varset_id, used internally in the handler to construct the API payload.
    class VariableSetUpdateRequest(APIRequest): """Request model for updating variable sets. Used for PATCH /varsets/:varset_id endpoint. Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/variable-sets See: docs/models/variables.md for reference """ varset_id: str = Field( ..., description="The variable set ID", pattern=r"^varset-[a-zA-Z0-9]{16}$", ) params: Optional[VariableSetParams] = Field( None, description="Variable set parameters to update", )

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