Skip to main content
Glama

terraform-cloud-mcp

create_workspace_variable

Create a new Terraform or environment variable in a workspace. Define variables with categories (terraform/env), optional descriptions, HCL support, and sensitivity flags to secure sensitive data. Use workspace ID, key, and parameters for precise configuration.

Instructions

Create a new variable in a workspace.

Creates a new Terraform or environment variable within a workspace. Variables can be marked as sensitive to hide their values.

API endpoint: POST /workspaces/{workspace_id}/vars

Args: workspace_id: The ID of the workspace (format: "ws-xxxxxxxx") key: The variable name/key category: Variable category ("terraform" or "env")

params: Additional variable parameters (optional): - value: Variable value - description: Description of the variable - hcl: Whether the value is HCL code (terraform variables only) - sensitive: Whether the variable value is sensitive

Returns: The created variable with its configuration and metadata

See: docs/tools/variables.md#create-workspace-variable for reference documentation

Input Schema

NameRequiredDescriptionDefault
categoryYes
keyYes
paramsNo
workspace_idYes

Input Schema (JSON Schema)

{ "$defs": { "VariableCategory": { "description": "Variable category options for workspace variables.\n\nDefines the type of variable:\n- TERRAFORM: Terraform input variables available in configuration\n- ENV: Environment variables available during plan/apply operations\n\nReference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/workspace-variables\n\nSee:\n docs/models/variables.md for reference", "enum": [ "terraform", "env" ], "title": "VariableCategory", "type": "string" }, "WorkspaceVariableParams": { "description": "Parameters for workspace variable operations without routing fields.\n\nThis model provides all optional parameters for creating or updating workspace\nvariables, separating configuration parameters from routing information like\nworkspace ID and variable ID.\n\nReference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/workspace-variables\n\nSee:\n docs/models/variables.md for reference", "properties": { "category": { "anyOf": [ { "$ref": "#/$defs/VariableCategory" }, { "type": "null" } ], "default": null, "description": "Variable category (terraform or env)" }, "description": { "anyOf": [ { "maxLength": 512, "type": "string" }, { "type": "null" } ], "default": null, "description": "Description of the variable", "title": "Description" }, "hcl": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Whether the value is HCL code (only valid for terraform variables)", "title": "Hcl" }, "key": { "anyOf": [ { "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Variable name/key", "title": "Key" }, "sensitive": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Whether the variable value is sensitive", "title": "Sensitive" }, "value": { "anyOf": [ { "maxLength": 256000, "type": "string" }, { "type": "null" } ], "default": null, "description": "Variable value", "title": "Value" } }, "title": "WorkspaceVariableParams", "type": "object" } }, "properties": { "category": { "title": "Category", "type": "string" }, "key": { "title": "Key", "type": "string" }, "params": { "anyOf": [ { "$ref": "#/$defs/WorkspaceVariableParams" }, { "type": "null" } ], "default": null, "title": "Params" }, "workspace_id": { "title": "Workspace Id", "type": "string" } }, "required": [ "workspace_id", "key", "category" ], "type": "object" }

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