Skip to main content
Glama

terraform-cloud-mcp

create_state_version

Generates and sets a new state version for a specified Terraform Cloud workspace, enabling state migration and management. Requires workspace ID, serial, MD5 hash, and optional parameters like encoded state files or lineage.

Instructions

Create a state version in a workspace.

Creates a new state version and sets it as the current state version for the given workspace. The workspace must be locked by the user creating a state version. This is most useful for migrating existing state from Terraform Community edition into a new HCP Terraform workspace.

API endpoint: POST /workspaces//state-versions

Args: workspace_id: The ID of the workspace (format: "ws-xxxxxxxx") serial: The serial number of this state instance md5: An MD5 hash of the raw state version params: Additional state version parameters (optional): - state: Base64 encoded raw state file - lineage: Lineage of the state version - json_state: Base64 encoded JSON state - json_state_outputs: Base64 encoded JSON state outputs - run_id: The ID of the run to associate with the state version

Returns: The created state version data including download URLs and status information

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

Input Schema

NameRequiredDescriptionDefault
md5Yes
paramsNo
serialYes
workspace_idYes

Input Schema (JSON Schema)

{ "$defs": { "StateVersionParams": { "description": "Parameters for state version operations without routing fields.\n\nThis model provides all optional parameters for creating state versions,\nreusing field definitions from StateVersionCreateRequest. It separates configuration\nparameters from routing information.\n\nReference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/state-versions\n\nSee:\n docs/models/state_versions.md for reference", "properties": { "json-state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Base64 encoded json state, as expressed by \"terraform show -json\"", "title": "Json-State" }, "json-state-outputs": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Base64 encoded output values as represented by \"terraform show -json\"", "title": "Json-State-Outputs" }, "lineage": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Lineage of the state version", "title": "Lineage" }, "md5": { "anyOf": [ { "pattern": "^[a-fA-F0-9]{32}$", "type": "string" }, { "type": "null" } ], "default": null, "description": "An MD5 hash of the raw state version", "title": "Md5" }, "run_id": { "anyOf": [ { "pattern": "^run-[a-zA-Z0-9]{16}$", "type": "string" }, { "type": "null" } ], "default": null, "description": "The ID of the run to associate with the state version", "title": "Run Id" }, "serial": { "anyOf": [ { "minimum": 0, "type": "integer" }, { "type": "null" } ], "default": null, "description": "The serial of the state version", "title": "Serial" }, "state": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Base64 encoded raw state file", "title": "State" } }, "title": "StateVersionParams", "type": "object" } }, "properties": { "md5": { "title": "Md5", "type": "string" }, "params": { "anyOf": [ { "$ref": "#/$defs/StateVersionParams" }, { "type": "null" } ], "default": null, "title": "Params" }, "serial": { "title": "Serial", "type": "integer" }, "workspace_id": { "title": "Workspace Id", "type": "string" } }, "required": [ "workspace_id", "serial", "md5" ], "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