Requirement:
The requirement is to migrate the terraform state to Terraform Enterprise which is present locally which is created by using the Terraform OSS.
Procedure:
Follow the below procedure to migrate the state file from local OSS system to Terraform Enterprise.
- Add the terraform cloud block in your terraform OSS code:
terraform {
cloud {
hostname = "<TFE Hostname>"
organization = "<Test Org>"
workspaces {
name = "<Workspace name>"
}
}
}
- Authenticate to terraform enterprise from your local machine by executing the command
terraform login <TFE FQDN>
- It will ask to generate the token through browser, please comment yes if you would like to create a new one and login to TFE to create a new token
- Run the terraform init as mentioned here.
- Confirm
yes
to migrate the state file.