Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion website/docs/cloud-docs/migrate/tf-migrate/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ To configure your API token, set the `TF_GIT_PAT_TOKEN` environment variable
$ export TF_GIT_PAT_TOKEN=<TOKEN>
```


## Supported backends

The `tf-migrate` tool supports migrating state from the following backends to HCP Terraform or Terraform Enterprise:
Expand All @@ -119,6 +118,20 @@ The `tf-migrate` tool supports migrating state from the following backends to HC

`tf-migrate` does not support migrating state from an existing `cloud` integration or `remote` backend.

## Supported workspace workflows

Versions 1.1.0 and newer of `tf-migrate` can create CLI- or VCS-driven HCP Terraform workspaces.

The `tf-migrate` tool will only prompt you to create a VCS-driven workspace if you meet the following requirements:

- Your local configuration is a Git repository.
- Your local Git repository has either GitHub or GitLab configured as a remote.
- Your HCP Terraform organization has at least one VCS OAuth connection configured for GitHub or GitLab.

If your HCP Terraform organization has more than one VCS connection configured, `tf-migrate` will ask you to choose which VCS connection to use.

If your local configuration does not meet all of the above requirements, `tf-migrate` automatically creates a CLI-driven workspace instead.

## 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:
Expand Down
19 changes: 18 additions & 1 deletion website/docs/cloud-docs/migrate/tf-migrate/reference/prepare.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The `tf-migrate prepare` command prompts you for the following information:
- The HCP Terraform or Terraform Enterprise organization to migrate your state to.
- If you would like to create a new branch named `hcp-migrate-<BRANCH>` where `<BRANCH>` is the name of the branch you currently have checked out.
- If you would like it to automatically create a pull request with the updated code change when the migration is complete.
- If you would like to create a CLI or VCS-driven workspace. Refer to [supported workspace workflows](/terraform/cloud-docs/migrate/tf-migrate#supported-workspace-workflows) for the requirements your configuration must meet to support a VCS-driven workspace.

The `tf-migrate prepare` command generates a new Terraform configuration in the `_hcp-migrate-configs` directory to perform the migration. This configuration creates the following resources:

Expand All @@ -29,7 +30,7 @@ The `tf-migrate prepare` command generates a new Terraform configuration in the
- A new local git branch if you responded to the prompt to create a new branch with `yes`.
- A new pull request in the remote git repository if you responded to the prompt to create a pull request with `yes`.

The `tf-migrate` CLI tool adds the generated configuration to the `.gitignore` file so that the configuration is not committed to source control.
The `tf-migrate` tool adds the generated configuration to the `.gitignore` file so that the configuration is not committed to source control.

The `tf-migrate` tool creates the following structure in HCP Terraform or Terraform Enterprise depending on your local configuration:

Expand Down Expand Up @@ -61,6 +62,22 @@ $ tf-migrate prepare
└────────────────────────────┘
Enter the name of the HCP Terraform organization to migrate to: my-org-1
✓ You have selected organization my-org-1 for migration

Current repository was found on github.com. Do you want to create VCS-driven workspaces ... ?

Enter a value: yes

✓ Found 4 VCS providers
┌────────────────────────────┬──────────────────┬─────────────────┐
│ Available VCS Providers │ Service Provider │ OAuth Client ID │
├────────────────────────────┤──────────────────┤─────────────────┤
│ github-dev │ GitHub │ oc-ABC123DEF456 │
│ github-internal │ GitHub │ oc-GHI789JKL012 │
└───────────────────────────────────────────────┴─────────────────┘

Enter the OAuth client ID of the VCS provider from the above list to create the VCS-driven workspace: oc-ABC123DEF456

✓ You have selected VCS provider GitHub for migration
✓ Found 2 directories with Terraform files
┌────────────────────────────────┐
│ Terraform File Directories │
Expand Down