Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions registry/Excellencedev/templates/hetzner-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ locals {
hcloud_server_types = {
for st in jsondecode(data.http.hcloud_server_types.response_body).server_types :
st.name => {
cores = st.cores
memory_gb = st.memory
disk_gb = st.disk
locations = [for l in st.locations : l.name]
deprecated = st.deprecated
cores = st.cores
memory_gb = st.memory
disk_gb = st.disk
architecture = st.architecture
locations = [for l in st.locations : l.name]
deprecated = st.deprecated
}
if st.deprecated == false
}
Expand All @@ -162,6 +163,19 @@ locals {
data.coder_parameter.hcloud_location.value
)
]

# Map Hetzner architecture (x86 or arm) to Coder agent architecture (amd64 or arm64)
agent_arch = try(
lookup(
{
"x86" = "amd64"
"arm" = "arm64"
},
local.hcloud_server_types[data.coder_parameter.hcloud_server_type.value].architecture,
"amd64" # Fallback if not returned
),
"amd64" # Fallback for template setup
)
}

data "coder_provisioner" "me" {}
Expand All @@ -187,7 +201,7 @@ data "coder_parameter" "home_volume_size" {

resource "coder_agent" "main" {
os = "linux"
arch = "amd64"
arch = local.agent_arch

metadata {
key = "cpu"
Expand Down