How-To: Migrate Terraform State Into Scalr

Author
Ryan Fee Aug 14, 2020 • 5 Min Read
Share:

Terraform open source is used across the industry for IaC deployments and as users become more familiar with it they love the flexibility but run into issues around scalability. A DevOps administrator’s primary concern is generally around central state storage when scaling Terraform. Likely the administrator already has several state files stored locally, in S3, or potentially a remote operations backend, but hitting the point where issues around overall management, operations, or cost force the issue of proper tooling.

Scalr solves problems relating to the collaborative use of Terraform including state management, auditing, policy enforcement, and GitOps automation. However, the idea of migrating state into Scalr may seem like a daunting task. The migration of state into Scalr is a very simple process as outlined below.

How do I migrate state into Scalr?

Migrating state to Scalr is simply done by configuring your template to use Scalr as a remote backend. Regardless of where you 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 IaCP.

  • If you are already using a remote backend you simply need to update the terraform{} block to be similar to the example below
  • If you are migrating local state you need to add the complete terraform{} block similar to this example.
  • Run terraform init to migrate the state and answer “yes” to the prompt. This will create the workspace and upload the state to Scalr.
  • In the Scalr UI you can see the workspace and the state outputs.
Scalr UI

Want to give this a try for yourself? Sign up for free today! Check out the docs to learn more.

Ready to get started?

Scalr is free for up to 5 users