Scalr
Scalr
May 30, 2023

How to easily migrate from Terraform Cloud to Scalr

By
Ryan Fee

A migration form one piece of software to another is never trivial, especially when that software manages all of your infrastructure. Often a cost benefit analysis is done to see if the effort to migrate is worth the savings that you are receiving with the new software. At Scalr, we believe in being transparent as well as fair, which is why we make it seamless to migrate into as well as out of Scalr. There are two ways of doing this, first is with our migration module and second is by updating your backend or code block.

Migration Module

If you’re using Terraform to everything else, then why not use it to migrate from Terraform Cloud to Scalr? Our module will use TFC and Scalr API tokens to migrate the following objects:

  • TFC Organizations will become Scalr environments.
  • Workspaces will become Scalr workspace.
  • Variables, both Terraform and environment variables, will be converted to Terraform and Scalr shell variables.
  • The current state file. 

You will also have the option to do a mass migration at once or choose to do specific workspaces as needed.

The migration module in use

General Migration from any Remote Backend

If you would prefer to do the migration with the module mentioned above, the process is straight forward. Before starting, make sure you have stopped all operations in Terraform Cloud.

First, pull down the state from Terraform Cloud:

terraform state pull > terraform.state

Next, get the API token from Scalr:

terraform login <account-name>.scalr.io

Update the code and add Scalr as the new cloud backend:

terraform {
  cloud {
    hostname = "<account-name>.scalr.io"
    organization = "<environment-name>"

    workspaces {
      name = "<workspace-name>"
    }
  }
}

To initialize Scalr as the backend run:

terraform init

Finally run:

terraform state push terraform.state


Check out the video below for a longer more detailed explanation.

You will now see the state in the Scalr workspace. Get started using Scalr today!

Note: While this blog references Terraform, everything mentioned in here also applies to OpenTofu. New to OpenTofu? It is a fork of Terraform 1.5.7 as a result of the license change from MPL to BUSL by HashiCorp. OpenTofu is an open-source alternative to Terraform that is governed by the Linux Foundation. All features available in Terraform 1.5.7 or earlier are also available in OpenTofu. Find out the history of OpenTofu here.

Start using the Terraform platform of the future.

A screenshot of the modules page in the Scalr Platform