Skip to main content
Glama

update_project

Modify Terraform Cloud project settings, including name, description, auto-destroy duration, and tags. Only specified attributes are updated; others remain unchanged. Uses PATCH /projects/{project_id}.

Instructions

Update an existing project.

Modifies the settings of a Terraform Cloud project. This can be used to change attributes like name, description, auto-destroy duration, or tags. Only specified attributes will be updated; unspecified attributes remain unchanged.

API endpoint: PATCH /projects/{project_id}

Args: project_id: The ID of the project to update (format: "prj-xxxxxxxx") params: Project parameters to update (optional): - name: New name for the project - description: Human-readable description of the project - auto_destroy_activity_duration: How long each workspace should wait before auto-destroying (e.g., '14d', '24h') - tag_bindings: List of tag key-value pairs to bind to the project

Returns: The updated project with all current settings and configuration

See: docs/tools/project.md for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNo
project_idYes

Implementation Reference

  • The primary handler function implementing the 'update_project' tool. It processes input parameters using Pydantic models, constructs the API payload for updating project attributes and tag bindings, and performs the PATCH request to the Terraform Cloud API.
    @handle_api_errors async def update_project( project_id: str, params: Optional[ProjectParams] = None ) -> APIResponse: """Update an existing project. Modifies the settings of a Terraform Cloud project. This can be used to change attributes like name, description, auto-destroy duration, or tags. Only specified attributes will be updated; unspecified attributes remain unchanged. API endpoint: PATCH /projects/{project_id} Args: project_id: The ID of the project to update (format: "prj-xxxxxxxx") params: Project parameters to update (optional): - name: New name for the project - description: Human-readable description of the project - auto_destroy_activity_duration: How long each workspace should wait before auto-destroying (e.g., '14d', '24h') - tag_bindings: List of tag key-value pairs to bind to the project Returns: The updated project with all current settings and configuration See: docs/tools/project.md for reference documentation """ # Extract parameters from the params object if provided param_dict = params.model_dump(exclude_none=True) if params else {} # Create request using Pydantic model request = ProjectUpdateRequest(project_id=project_id, **param_dict) # Create base API payload using utility function payload = create_api_payload( resource_type="projects", model=request, exclude_fields={"project_id"}, ) # Handle tag bindings if present if request.tag_bindings: tag_bindings_data = [] for tag in request.tag_bindings: tag_bindings_data.append( { "type": "tag-bindings", "attributes": {"key": tag.key, "value": tag.value}, } ) if "relationships" not in payload["data"]: payload["data"]["relationships"] = {} payload["data"]["relationships"]["tag-bindings"] = {"data": tag_bindings_data} # Remove tag-bindings from attributes if present since we've moved them to relationships if "tag-bindings" in payload["data"]["attributes"]: del payload["data"]["attributes"]["tag-bindings"] # Log payload for debugging logger = logging.getLogger(__name__) logger.debug(f"Update project payload: {payload}") # Make API request return await api_request(f"projects/{project_id}", method="PATCH", data=payload)
  • Pydantic model defining the optional input parameters (e.g., name, description, tag_bindings) for the 'update_project' tool, inherited from BaseProjectRequest.
    class ProjectParams(BaseProjectRequest): """Parameters for project operations without routing fields. This model provides all optional parameters for creating or updating projects, reusing field definitions from BaseProjectRequest. It separates configuration parameters from routing information like organization and project ID. Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/projects Note: When updating a project, use this model to specify only the attributes you want to change. Unspecified attributes retain their current values. All fields are inherited from BaseProjectRequest. See: docs/models/project.md for reference """ # Inherits model_config and all fields from BaseProjectRequest
  • Registration of the 'update_project' tool using the MCP decorator with write_tool_config for schema and permissions.
    mcp.tool(**write_tool_config)(projects.update_project)

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