mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
chore: implement dogfood template to select region based on user group (#18115)
Co-authored-by: Atif Ali <atif@coder.com>
This commit is contained in:
@ -130,11 +130,29 @@ data "coder_parameter" "image_type" {
|
||||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
default_regions = {
|
||||
// keys should match group names
|
||||
"north-america" : "us-pittsburgh"
|
||||
"europe" : "eu-helsinki"
|
||||
"australia" : "ap-sydney"
|
||||
"south-america" : "sa-saopaulo"
|
||||
"africa" : "za-cpt"
|
||||
}
|
||||
|
||||
user_groups = data.coder_workspace_owner.me.groups
|
||||
user_region = coalescelist([
|
||||
for g in local.user_groups :
|
||||
local.default_regions[g] if contains(keys(local.default_regions), g)
|
||||
], ["us-pittsburgh"])[0]
|
||||
}
|
||||
|
||||
|
||||
data "coder_parameter" "region" {
|
||||
type = "string"
|
||||
name = "Region"
|
||||
icon = "/emojis/1f30e.png"
|
||||
default = "us-pittsburgh"
|
||||
default = local.user_region
|
||||
option {
|
||||
icon = "/emojis/1f1fa-1f1f8.png"
|
||||
name = "Pittsburgh"
|
||||
|
Reference in New Issue
Block a user