What are Terraform Cloud Workspaces?

Christian Talavera
2 min readAug 10, 2021

--

Terraform Cloud Workspaces

Just like using alternate state files locally with terraform workpace, HashiCorp offers a way to do the same thing, only remotely with Terraform's offered cloud servers. This service is called HashiCorp Terraform Cloud Workspaces.

Specific directories for deployments can be hosted separately in the cloud; HashiCorp manages the storage, segregation and security to reduce administration overhead.

By default, Terraform Cloud Workspaces always stores old versions of state files; these backup versions can be then shared across teams and organizations. in addition to this, Cloud Workspaces records and maintains a log of all execution activity performed, which allows for easy auditing and deployment investigations.

Another benefit offered by using Cloud Workspaces is that Terraform commands can be executed on Terraform managed servers, eliminating the need for the use of a dedicated server. In addition, Terraform commands can be triggered on Cloud Workspaces by other API calls, such as an action in GitHub.

Terraform Workspaces vs. Terraform Cloud Workspaces

Characteristics of Terraform Workspaces:

  • Alternate state files are stored in the same working directory on either the local machine or a supported backend running Terraform; these are stored in a separate terraform.tfstate.d directory, and each state file that is tracked is housed in its own directory. These are managed by the administrator directly.
  • Any credentials that need to be used are either entered in the prompt or stored as environmental variables
  • Any custom variables that are needed by the project code are stored in either the .tfvars file, as an CLI argument or as an environmental variable
  • Terraform configuration management is controlled locally in the project working directory

Characteristics of Terraform Cloud Workspaces:

  • Alternate state files are stored on Terraform-managed cloud servers instead of being managed y the administrator.
  • Any credentials that are needed would be stored in the Terraform cloud as sensitive variables
  • Any custom variables that are needed by the project code are stored on Terraform cloud servers as well
  • Terraform configuration is stored in a linked version control repository such as GitHub, or changed using CLI or a connecting API

--

--

Christian Talavera
Christian Talavera

Written by Christian Talavera

DevOps Engineer writing about breaking into the industry

No responses yet