Using workspaces to manage environments
In Terraform, there is the concept of workspaces, which enable the same Terraform configuration to be used in order to build multiple environments.
Each of these configurations will be written to a different Terraform state and will, thus, be isolated from the other configurations. Workspaces can be used to create several environments for our infrastructure.
Be careful: in this recipe, we will study the workspaces of Terraform states, also called Terraform CLI workspaces, which are different from the Terraform Cloud workspaces used in HCP, which we will study in Chapter 14, Using Terraform Cloud to Improve Team Collaboration, in the recipe Using workspaces in Terraform Cloud.
In this recipe, we will study the use of Terraform workspaces in Terraform configurations, with the execution of Terraform CLI commands.
Getting ready
The purpose of this recipe is for an application to create an Azure resource group for...