$ terraform workspace new staging
Created and switched to workspace "staging"!
You're now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
for this configuration.
$ terraform apply
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
count_api = 4
count_www = 1
shared_all = shared
size_api = n1-standard-1
size_www = n1-standard-1
$ terraform workspace new production
Created and switched to workspace "production"!
You're now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
for this configuration.
$ terraform apply
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
count_api = 18
count_www = 2
shared_all = shared
size_api = n1-standard-4
size_www = n1-standard-4
$ terraform workspace new testing
Created and switched to workspace "testing"!
You're now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
for this configuration.
$ terraform apply
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
count_api = 1
count_www = 1
shared_all = shared
size_api = n1-standard-1
size_www = n1-standard-1
@ivanpetrushev - this could be simplified so that the final map is empty if there is no match for the current workspace.
Basically, there is no need to merge
local.env["defaults"]
with itself, an empty map will do just fine.