Skip to content

sompol13/learn-state-migration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Migrate State to Terraform Cloud

As a current user of the Terraform CLI, you are responsible for maintaining a state file as a source of truth for your cloud infrastructure. You can keep your state file secure and share it with collaborators, by migrating it to Terraform Cloud without interrupting or recreating your existing infrastructure.

Create state (Local)

  • terraform init
  • terraform apply
  • Terraform will output a three word randomly generated pet name.

Set up Terraform Cloud

Now that you have a local state file, you need to create a cloud code block in your configuration.

Migrate the state file

  • terraform init
  • Configure the Terraform Cloud workspace.
  • Add variable name_length to the workspace

Initiate a run in the new workspace

  • After verifying that the state was migrated to the Terraform Cloud workspace, remove the local state file.
  • rm terraform.tfstate
  • terraform apply

Screen Shot 2565-01-29 at 13 52 42

Reference

https://learn.hashicorp.com/tutorials/terraform/cloud-migrate#set-up-the-remote-backend

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages