Skip to content

Commit 72a6749

Browse files
authored
Repo sync (#1274)
This is an automated pull request to sync changes between the public and private unified docs repos. To preserve continuity across repos, _do not squash_ this pull request.
2 parents 652e6f0 + 8422324 commit 72a6749

File tree

1 file changed

+11
-11
lines changed
  • content/terraform-docs-common/docs/cloud-docs/migrate

1 file changed

+11
-11
lines changed

content/terraform-docs-common/docs/cloud-docs/migrate/index.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ description: >-
66

77
# Migrate Terraform state to HCP Terraform or Terraform Enterprise
88

9-
This topic describes how to migrate existing Terraform state files to HCP Terraform or Terraform Enterprise without first de-provisioning them. Refer to [State](/terraform/language/state) in the Terraform configuration language reference for additional information about Terraform state.
9+
This topic describes how to migrate existing Terraform state files to HCP Terraform or Terraform Enterprise without first de-provisioning them. Refer to [State](/terraform/language/state) in the Terraform configuration language reference for additional information about Terraform state.
1010

1111
## Overview
1212

1313
Perform the following actions to migrate existing resources to one or more workspaces in HCP Terraform or Terraform Enterprise:
1414

15-
1. Stop all Terraform operations associated with the state files.
15+
1. Stop all Terraform operations associated with the state files.
1616
1. Migrate Terraform state files to HCP Terraform or Terraform Enterprise.
1717

1818
You have three options to migrate your state:
@@ -39,9 +39,9 @@ Stop all Terraform operations associated with the state files. This may require
3939
4040

4141
1. Add the `cloud` block to your Terraform configuration and specify the following fields:
42-
1. `hostname` field: Specify either `app.terraform.io` for HCP Terraform or the hostname of your Terraform Enterprise deployment.
43-
1. `organization` field: Specify your HCP Terraform or Terraform Enterprise organization.
44-
1. `workspaces` block: Add a `tags` or `name` field and specify one or more destination workspaces as a list of strings.
42+
1. `hostname` field: Specify either `app.terraform.io` for HCP Terraform or the hostname of your Terraform Enterprise deployment.
43+
1. `organization` field: Specify your HCP Terraform or Terraform Enterprise organization.
44+
1. `workspaces` block: Add a `tags` or `name` field and specify one or more destination workspaces as a list of strings.
4545

4646
Refer to [The `cloud` Block](/terraform/cli/cloud/settings#the-cloud-block) in the Terraform CLI documentation for additional information. The following example migrates the state associated with the configuration to the `networking` workspace on HCP Terraform:
4747

@@ -69,17 +69,17 @@ Stop all Terraform operations associated with the state files. This may require
6969
$ md5sum terraform.tfstate
7070
690a3f8ae079c629494a52c68757d585 terraform.tfstate
7171
```
72-
72+
7373
1. If the workspace does not yet exist in your organization, send a `POST` request to the `/organizations/:organization_name/workspaces` endpoint to create it. Otherwise, proceed to the next step. Refer to the following topics for details:
74-
- [Create a workspace](/terraform/cloud-docs/api-docs/workspaces#create-a-workspace) in the HCP Terraform API reference documentation.
74+
- [Create a workspace](/terraform/cloud-docs/api-docs/workspaces#create-a-workspace) in the HCP Terraform API reference documentation.
7575
- [Create a workspace](/terraform/enterprise/api-docs/workspaces#create-a-workspace) in the Terraform Enterprise API reference documentation.
7676
1. Send a `POST` request to the `/workspaces/:workspace_id/actions/lock` endpoint to lock the workspace. Refer to the following topics for details:
77-
- [Lock a workspace](/terraform/cloud-docs/api-docs/workspaces#lock-a-workspace) in the HCP Terraform API reference documentation.
78-
- [Lock a workspace](/terraform/enterprise/api-docs/workspaces#lock-a-workspace) in the Terraform Enterprise API reference documentation.
77+
- [Lock a workspace](/terraform/cloud-docs/api-docs/workspaces#lock-a-workspace) in the HCP Terraform API reference documentation.
78+
- [Lock a workspace](/terraform/enterprise/api-docs/workspaces#lock-a-workspace) in the Terraform Enterprise API reference documentation.
7979
1. To upload your state files to the workspace, send a `POST` request to the `/workspaces/:workspace_id/state-versions` endpoint. Specify the MD5 string in the `data.attributes.md5` field and encoded state file in the `data.attributes.state` field of the request body. Refer to the following topics for details:
80-
- [Create a state version](/terraform/cloud-docs/api-docs/state-versions#create-a-state-version) in the HCP Terraform API reference documentation.
80+
- [Create a state version](/terraform/cloud-docs/api-docs/state-versions#create-a-state-version) in the HCP Terraform API reference documentation.
8181
- [Create a state version](/terraform/enterprise/api-docs/state-versions#create-a-state-version) in the Terraform Enterprise API reference documentation.
82-
1. Send a `POST` request to the `/workspaces/:workspace_id/actions/unlock` endpoint to unlock the workspace.
82+
1. Send a `POST` request to the `/workspaces/:workspace_id/actions/unlock` endpoint to unlock the workspace.
8383

8484
Refer to the following external article for an example of how to create a script in Python to automate multiple state files:
8585
[Migrating A Lot of State with Python and the HCP Terraform (previously Terraform Cloud) API](https://medium.com/hashicorp-engineering/migrating-a-lot-of-state-with-python-and-the-terraform-cloud-api-997ec798cd11). The example uses the [Workspaces API](/terraform/cloud-docs/api-docs/workspaces#create-a-workspace) to create the necessary workspaces in HCP Terraform and the [State Versions API](/terraform/cloud-docs/api-docs/state-versions) to migrate the state files to those workspaces.

0 commit comments

Comments
 (0)