In this hands-on lab, you will learn how to import Azure resources into Terraform state, view objects in Terraform state, and migrate your state to Terraform Cloud. **Note:** To complete this lab, you will need your own free Terraform Cloud account. You can sign up for a free account at [Terraform Cloud](https://app.terraform.io/public/signup).
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Import Existing Resources into Terraform State
- Open the existing Terraform configuration file in
C:MigrateState
. - Initialize the working directory.
- Log in to Azure using the Azure CLI.
- Import the exsting resource group into your local state.
- Open the existing Terraform configuration file in
- Inspect the Local State File
Verify the resource group has been imported into the state file using the Terraform CLI.
- Configure a Terraform Cloud Workspace
- Create a Terraform Cloud Workspace.
- Update the
main.tf
file with the cloud configuration block.
- Migrate State to Terraform Cloud
Initialize the working directory and migrate the state file to Terraform Cloud.
- Delete the Local State File
Delete the local state file and the state file backup.