The Advantages of Using Terraform Cloud or Terraform Enterprise for Remote State
Mar 31, 2020
Because Terraform is a stateful application, if you need to change or delete something, it will know what it built and can go back and make those changes for you.
- Sean CarolanSolutions Engineer, HashiCorp
Sometimes our open-source users ask us, "Why should I use Terraform Enterprise to store my remote state?"
Terraform is a stateful application. What that means is that it keeps track of everything it builds in your cloud environments, so that if you need to change something or delete something later, Terraform will know what it built, and it can go back and make those changes for you.
That state is stored in what we call a state file. This is an important file that keeps track of everything that Terraform builds, and it's used by Terraform in case you need to change anything.
Protect your state file
It's important to protect your state file. If you lose the state file, Terraform will have no way to know what it built or what could be safe to delete or change.
The default setting of Terraform open source is to store your state file on your local laptop or your workstation. This works great for a single developer or someone working alone on a project, but as soon as you have 2 or more people trying to work on the same project, this can become a problem. Multiple users need to access the same state file, and if it's stuck here on my laptop, my coworkers can't use that state file to change the infrastructure that we built.
Therefore, you can use what we call "remote state." This is a centrally stored state file where multiple uses can access the state of your infrastructure without stepping on each other's toes. Remote state can be stored either on cloud platform storage, like S3, or inside of Terraform Enterprise.
The costs of "free" open source
One of the biggest myths of open source is the word "free." It's free in the sense that, yes, you can download and use these things, but you'll have to put in some time and labor to build out your tooling in order to use it correctly.
If I decide to use Amazon S3 to store my remote state, I need to learn how to build S3 buckets in a secure way, to encrypt them properly. I need to install DynamoDB to make sure that my Terraform state file is locked correctly.
The question really is, Do I want to build this tool and maintain it myself, or would I rather pay for something that works right out of the box?
Terraform Enterprise (and Terraform Cloud) provides all of the features you need with remote state, including locking, collaboration, and encryption, right out of the box. This frees you up to get back to work and do the things you need to do instead of building your own tooling to deploy infrastructure.