Interested in learning more about env0?

Chris Noon

Sales Engineer

In mid-2021, Tim Davis wrote a blog on migrating the state from TFC (Terraform Cloud) to another IaC management platform.

It does a great job of highlighting how TFC and env0 function in terms of both runs and state, or at least it did. Since this original post, the env0 Platform evolution has been quick and with features and improvements coming out every week, it can be hard to keep up. Let me elaborate…

The original article mentions “env0 does not offer remote state backend capabilities…yet (Stay tuned)”. We do now! env0 recently added remote backend support that stores customer state files in a remote location (per customer, per environment). This now allows our customers to pick between three methods of managing state files.

  • env0 can store the state files “locally” within the env0 infrastructure. Both our SaaS and hybrid deployment options run on Kubernetes, and PVs (persistent volumes) are created and used to store state per customer, per environment.
  • env0 can store the state in any external backend as configured by the client in their code (such as S3).
  • env0 can store state in a dedicated per customer, per environment env0 managed remote backend. This capability allows our customers to have the peace of mind their state is separated from the application all while not having to manage or pay for storage.

The key takeaway here is that these three options allow you as the customer to make design decisions based on your desired solution.

Migrating your remote state

Now with these three options available to our users, we are able to seamlessly migrate both the runs and state to env0 and provide the same governance and compliance for the state.

In these examples, we will assume you are migrating your run and state from TFC to env0.

TFC remote backend to env0 remote backend

This migration method can be somewhat challenging because you have to move the state via a proxy, typically a local machine or jump box/bastion host. It also requires a login to TFC and env0. The below procedure can be used to migrate TFC local state to the env0 local state.

Login to TFC:

Remove the cloud block in the config (if configured)

No changes should be seen.

Login to env0:

Add the env0 remote block:

Update the env0 template with the correct VCS configuration.

We are working hard to have this scripted. Keep your eyes peeled.

Existing remote state

Possibly the easiest type of migration is when using TFC with a remote state such as s3.  This migrates the run logic while leaving the state untouched.

The only part of the migration that can become troublesome is the replication of variables and environmental variables. To assist in the migration, we have created a script that will pull the data from your TFC workspace and create an equivalent env0 workspace, including moving your variables from one to the other.

TFC remote state to env0 remote state

This method is identical to the “TFC remote state to env0 local state” with one additional step at the end of the procedure. Enable “Use env0 remote backend” in the environment settings and redeploy, moving your state from env0 local to env0 remote backend.

Final Thoughts

These three migration methods allow you to migrate from TFC to env0 and have the state stored in any way that meets your business needs. We want to provide as much flexibility when moving over to env0 and we understand the state is an important part of the conversation.

If you are looking for features around executing remote runs locally, then I suggest you check out another recent post. And here's a guide to managing Terraform remote state using remote backend.

If you have any questions about state migration or env0 in general, please reach out to us and our team would be happy to help.

To learn more about the advantages of migrating from Terraform Cloud to env0, check out our Terraform Cloud Alternative page.

No items found.
Manage IaC at scale, with confidence 

Use custom workflows to model any process

Visualize all IaC changes pre and post-deployment

Gain code-to-cloud visibility and governance

Improve developer experience and collaboration

Chris Noon

Share this post

Manage IaC with confidence 

Use custom workflows to model any process

Visualize all changes pre and post-deployment

Gain code-to-cloud visibility and governance

Improve developer experience and collaboration

Start Free Trial
See what env0 can do for you

env0 is the best way to deploy, scale, and manage your Terraform and other Infrastructure as Code tools.

Milo waving