Terraform
The tf-migrate stacks prepare generates new Terraform configuration to migrate your HCP Terraform workspace to a Stack.
Usage
$ tf-migrate stacks prepare [options]
Description
The tf-migrate stacks prepare command prompts you for the following information:
- A name for the Stack.
- A name for the new project to deploy the Stack to. This project must not already exist.
The tf-migrate prepare command copies your configuration and local modules to create a new Terraform Stack configuration in the _stacks_generated directory. It also generated Terraform configuration to perform the migration in the stacks_migration_infra directory.
This command does not change your existing configuration.
Example
The tf-migrate stacks prepare command generates the configuration to migrate this HCP Terraform workspace to a Stack. The following example creates a Stack named my-new-stack in the my-project project.
$ tf-migrate stacks prepare
tf-migrate stacks prepare
✓ Environment readiness checks completed
✓ Extracted terraform configuration data from current directory
Enter the name of the stack to be created: my-new-stack
Enter the name of the project under which stack is to be created: my-project
✓ Fetched latest state file for workspace: already-modular
✓ Parsed state file for workspace: already-modular
✓ Extracted variables from terraform configuration
✓ Extracted providers from terraform configuration
✓ Extracted outputs blocks from terraform configuration
✓ Created components from module blocks from terraform configuration
✓ Created deployments for workspaces provided
✓ Stack configuration files generated successfully
✓ Completed sanity check: terraform stacks init
✓ Completed sanity check: terraform stacks fmt
✓ Completed sanity check: terraform stacks validate
Please review the generated files in the stacks directory before proceeding to execute:
1. Add stack authentication - https://developer.hashicorp.com/terraform/language/stacks/deploy/authenticate
2. Resolve any PLACEHOLDER values for output block types, if any.
3. Resolve any PLACEHOLDER values for deployment input attributes, if any.
Available options
You can include the following flags when you run the tf-migrate prepare command:
| Option | Description | Default | Required |
|---|---|---|---|
-config-file | Specifies the path to an optional configuration file. Refer to tf-migrate configuration file reference for more information. | None | No |
-skip-workspaces | Specifies a comma-separated list of workspaces to exclude from the migration. | None | No |