added region whitelist

pull/52/head
Stephen Kirby 2 years ago
parent 25a2077668
commit 34ec21cfbc

@ -33,6 +33,12 @@ variable "mutable" {
type = bool type = bool
} }
variable "regions" {
default = []
description = "List of regions to include for region selection."
type = list(string)
}
locals { locals {
regions = { regions = {
"ams" = { "ams" = {
@ -254,8 +260,8 @@ data "coder_parameter" "fly_region" {
description = var.description description = var.description
default = var.default default = var.default
mutable = var.mutable mutable = var.mutable
dynamic "option" { dynamic "option" { # TODO: maybe set var.regions to all possible regions to avoid unessecary checks
for_each = { for k, v in local.regions : k => v if !(contains(var.exclude, k)) } for_each = { for k, v in local.regions : k => v if anytrue([for d in var.regions : k == d ]) || length(var.regions) == 0 }
content { content {
name = try(var.custom_names[option.key], option.value.name) name = try(var.custom_names[option.key], option.value.name)
icon = try(var.custom_icons[option.key], option.value.icon) icon = try(var.custom_icons[option.key], option.value.icon)

Loading…
Cancel
Save