Terraform
Migrate to HCP Terraform
The tf-migrate
CLI automatically migrates your Terraform Community Edition state and variable values to HCP Terraform or Terraform Enterprise. It also updates your local configuration with the new state storage location and optionally creates a pull request to update your code repository.
Hands-on: Complete the Migrate to HCP Terraform in bulk tutorial to get started with
tf-migrate
.
Overview
Complete the following steps to install and configure tf-migrate
:
- Download and install
tf-migrate
. - Configure
tf-migrate
to authenticate to HCP Terraform or Terraform Enterprise. - Optionally authenticate your VCS provider with your version control provider API key to create a pull request with your configuration changes.
- Optionally enable logging so that you can troubleshoot potential issues that may occur during the migration process.
Supported backends
The tf-migrate
tool supports migrating state from the following backends to HCP Terraform or Terraform Enterprise:
The tf-migrate
CLI does not support migrating state from an existing cloud
integration or remote
backend.
Enable logging
You can enable detailed logging by setting the TF_MIGRATE_ENABLE_LOG
environment variable to true
. When you enable this setting, tf-migrate
writes the logs to the following locations, depending on your operating system:
Platform | Location |
---|---|
macOS and Linux | /Users/<username>/.tf-migrate/logs/<commandName>/<date>.log |
Windows | C:\Users\<username>\.tf-migrate\logs\<commandName>\<date>.log |
You can set the TF_MIGRATE_LOG_LEVEL
environment variable to one of the following values to change the verbosity of the logs in order of decreasing verbosity:
Additional configuration
You can create an optional configuration file to modify the tf-migrate
CLI behavior and specify the path to the configuration file when you run tf-migrate prepare
. Any command-line flags you provide with these commands override the configuration file. Refer to the configuration reference for additional information.