Loading...
Loading...
Manage multiple environments with workspaces
Workspaces let you manage multiple environments from one config:
terraform workspace new staging
terraform workspace select staging
terraform workspace showUse terraform.workspace in resource names:
resource "azurerm_resource_group" "main" {
name = "app-${terraform.workspace}-rg"
}This creates app-dev-rg, app-staging-rg, app-prod-rg.
variable "instance_count" {
default = 2
}
resource "azurerm_resource_group" "main" {
name = "app-${terraform.workspace}-resources"
}