use single zone per name

pull/37/head
Muhammad Atif Ali 2 years ago
parent edb0403efd
commit 79805a8e90

@ -57,6 +57,12 @@ variable "custom_icons" {
type = map(string) type = map(string)
} }
variable "single_zone_per_region" {
default = true
description = "Whether to only include a single zone per region."
type = bool
}
locals { locals {
zones = { zones = {
# US Central # US Central
@ -712,11 +718,12 @@ data "coder_parameter" "region" {
dynamic "option" { dynamic "option" {
for_each = { for_each = {
for k, v in local.zones : k => v for k, v in local.zones : k => v
if anytrue([for d in var.regions : startswith(k, d)]) && (!var.gpu_only || v.gpu) if anytrue([for d in var.regions : startswith(k, d)]) && (!var.gpu_only || v.gpu) && (!var.single_zone_per_region || endswith(k, "-a"))
} }
content { content {
icon = try(var.custom_icons[option.key], option.value.icon) icon = try(var.custom_icons[option.key], option.value.icon)
name = try(var.custom_names[option.key], option.value.name) # if single_zone_per_region is true, remove the zone letter from the name
name = try(var.custom_names[option.key], var.single_zone_per_region ? replace(option.value.name, " \\(.*\\)", "") : option.value.name)
description = option.key description = option.key
value = option.key value = option.key
} }

Loading…
Cancel
Save