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
Name | Required | Description | Default |
---|---|---|---|
md5 | Yes | ||
params | No | ||
serial | Yes | ||
workspace_id | Yes |