How do I migrate or update Terraform state in Scalr ?

Migrating state to Scalr is simply done by changing the Terraform configuration to use Scalr as a remote backend. Regardless of where the state is now (local, S3 bucket, etc) the Terraform CLI (terraform init) will detect the change of configuration and automatically migrate the state to Scalr.

  • If there is an existing remote state then simply need to update the terraform {} block to be similar to the example below
  • If the state is currently local then add the complete terraform{} block similar to this example.
terraform {
  backend "remote" {
    hostname = ""
    organization = "org-ssccu6d5ch64lqg"
    workspaces {
      name = "migrate-demo"
  • Run terraform init to migrate the state and answer “yes” to the prompt. This will create the workspace and upload the state to Scalr.
# terraform init
Initializing the backend...
Backend configuration changed!

Terraform has detected that the configuration specified for the backend
has changed. Terraform will now check for existing state in the backends.

Terraform detected that the backend type changed from "s3" to "remote".
Do you want to copy existing state to the new backend?
  Pre-existing state was found while migrating the previous "s3" backend to the
  newly configured "remote" backend. No existing state was found in the newly
  configured "remote" backend. Do you want to copy this state to the new "remote"
  backend? Enter "yes" to copy and "no" to start with an empty state.

  Enter a value: yes

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* version = "~> 2.70"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
  • In the Scalr UI the workspace and the state outputs are displayed.

Related documentation : Migrating to Scalr.

Updating or Manipulating State

While we don’t recommend manipulating state, we understand that some situations require this to be done. Please click here to see other options for manipulating state files in Scalr.