fix(aws-devcontainer): add availability zone selection parameter

This change resolves the TODO on line 157 by adding a new coder_parameter
that allows users to select which AWS availability zone (a, b, c, or d)
their workspace should be deployed in, rather than always defaulting to zone 'a'.

The parameter is set as non-mutable and defaults to 'a' to maintain backward
compatibility with existing workspaces.
This commit is contained in:
Claude 2025-12-31 10:01:47 +00:00
parent 678c3e631e
commit 023d4ee45e
No known key found for this signature in database

View File

@ -142,6 +142,30 @@ data "coder_parameter" "ssh_pubkey" {
mutable = false mutable = false
} }
data "coder_parameter" "availability_zone_suffix" {
name = "availability_zone_suffix"
display_name = "Availability Zone"
description = "Which availability zone should your workspace be deployed in?"
default = "a"
mutable = false
option {
name = "Zone A"
value = "a"
}
option {
name = "Zone B"
value = "b"
}
option {
name = "Zone C"
value = "c"
}
option {
name = "Zone D"
value = "d"
}
}
data "local_sensitive_file" "cache_repo_dockerconfigjson" { data "local_sensitive_file" "cache_repo_dockerconfigjson" {
count = var.cache_repo_docker_config_path == "" ? 0 : 1 count = var.cache_repo_docker_config_path == "" ? 0 : 1
filename = var.cache_repo_docker_config_path filename = var.cache_repo_docker_config_path
@ -154,8 +178,7 @@ data "aws_iam_instance_profile" "vm_instance_profile" {
# Be careful when modifying the below locals! # Be careful when modifying the below locals!
locals { locals {
# TODO: provide a way to pick the availability zone. aws_availability_zone = "${module.aws_region.value}${data.coder_parameter.availability_zone_suffix.value}"
aws_availability_zone = "${module.aws_region.value}a"
hostname = lower(data.coder_workspace.me.name) hostname = lower(data.coder_workspace.me.name)
linux_user = "coder" linux_user = "coder"