terraform stacks migrate prepare-manifest reference
Use the terraform stacks migrate prepare-manifest command to generate a migrate
manifest from HCP Terraform workspaces to a Stack.
Usage
$ TF_STACKS_MIGRATE_EXPERIMENTAL=true terraform stacks <global-stacks-flags> migrate prepare-manifest <options> <workspace-id>...
Description
The terraform stacks migrate prepare-manifest command reads one or more HCP Terraform
workspaces, verifies that each workspace is ready for migration, downloads each
workspace's Terraform state file, and writes a migrate manifest.
Each workspace ID becomes a deployment entry in the manifest. The command uses the
workspace name as the deployment name and writes the workspace state to
./tfstates/<workspace-name>.tfstate relative to the manifest location. It also creates
the source configuration, Stack configuration, and translated state output directories
that the migrate workflow expects.
Refer to Migrate HCP Terraform workspaces to Terraform Stacks for an end-to-end migration workflow.
To use this command, you must authenticate your local Terraform CLI with HCP Terraform as a user that has permission to read the HCP Terraform workspace variables and state versions.
The command copies workspace variables into deployment inputs. It preserves non-sensitive
variable values in the manifest. HCP Terraform does not return sensitive variable values
from the API, so the manifest records sensitive metadata without the value. The command
also converts environment variables with names that start with TF_VAR_ into Terraform
input variables by removing the TF_VAR_ prefix.
Command arguments
workspace-id: One or more HCP Terraform workspace IDs to include in the migration, separated by spaces- Required.
- String.
Options
-migrate-manifest: The path where the command writes the migrate manifest.- Optional.
- String.
- Default:
migrate-manifest.json.
-source-config: The directory the manifest references as the traditional Terraform source configuration.- Optional.
- String.
- Default:
./source-config.
-stack-config: The directory the manifest references as the translated Terraform Stacks configuration.- Optional.
- String.
- Default:
./stack-config.
-json: Output progress events and the success message in JSON format instead of the default human-readable text format.- Optional.
- Boolean flag.
- Default: false.
Examples
The following command prepares a migrate manifest for two HCP Terraform workspaces:
$ TF_STACKS_MIGRATE_EXPERIMENTAL=true terraform stacks migrate prepare-manifest \
ws-abc123 ws-def456
The following command writes the manifest and generated directories to the ./migration directory:
$ TF_STACKS_MIGRATE_EXPERIMENTAL=true terraform stacks migrate prepare-manifest \
-migrate-manifest=./migration/migrate-manifest.json \
-source-config=./source-config \
-stack-config=./stack-config \
ws-abc123
The following command returns progress events in JSON format:
$ TF_STACKS_MIGRATE_EXPERIMENTAL=true terraform stacks migrate prepare-manifest \
-json \
ws-abc123
Global flags
Refer to Global flags reference for information about flags you can use with all commands.