The #1 question we get asked is “What are the best practices for using Scalr accounts, environments, and workspaces?”
This picture shows the logical organizational model in Scalr:
Working from the bottom up the recommended use of each “scope” is as follows:
Workspace
A workspace is used to deploy and manage logical sub-divisions of your infrastructure, such as networking, database, K8 clusters, application instances etc.
Workspace state can be shared to enable the use of shared infrastructure.
This is where a Terraform run is performed and a state file (and its history) are stored.
Variables (Terraform and shell) are assigned values to be passed into a run including provider credentials, possibly set at higher scopes.
Optionally define provider credentials for each environment (published via shell variables).
Note: While this blog references Terraform, everything mentioned in here also applies to OpenTofu. New to OpenTofu? It is a fork of Terraform 1.5.7 as a result of the license change from MPL to BUSL by HashiCorp. OpenTofu is an open-source alternative to Terraform that is governed by the Linux Foundation. All features available in Terraform 1.5.7 or earlier are also available in OpenTofu. Find out the history of OpenTofu here.