Remote Backend

Terraform uses persisted state data to keep track of the resources it manages. Most non-trivial Terraform configurations use a backend to store the state remotely. This lets multiple people access the state data and work together on that collection of infrastructure resources.

Terraform offers several state storage options, of which env0 supports Remote Backend, which has some great benefits such as:

  • No underlying infrastructure setup and management - env0 takes care of the setup as opposed to other approaches, where you need to do all the setup and management yourself (for example, S3 Backend requires you to create an S3 Bucket and an optional DynamoDB Table for locking beforehand)
  • Security - env0 stores the state securely for you and assures only you can access it
  • State consistency - Remote Backends assure that users won't overwrite each other's state with a locking mechanism and that they receive the most recent state on every Terraform operation
  • Local runs - By providing the Remote Backend configuration and a successful login, users can run Terraform operations locally while still working on a shared state.

Using env0's Remote Backend has additional advantages:

  • No Terraform Backend configuration when running inside env0 - you don't have to provide any type of configuration; you just deploy your code as is, and env0 will automatically configure it to use the Remote Backend
  • States UI - view the current version of your state as well as all of the previous versions
  • Correlation of Deployment to State - easily figure out which deployment is responsible for a specific change to your state (Coming soon)

Use Remote Backend In a New Environment

Using remote backend in your Environments is simple:

  • Create a new Environment
    • Check the Enable Remote State checkbox
    • Enter a Workspace Name

Here's what it looks like for Environments based on a pre-defined template:

Here's what it looks like for Environments based on a direct VCS integration:

That's it!


📘 Workspace name restrictions

env0 enforces that a Workspace Name must be unique among all Remote Backend Environments in the Organization. The Terraform configuration for the Remote Backend consists of Organization id and Workspace Name. Therefore, we have this limitation to block possible state conflicts.

Did this page help you?