Skip to content

Commit 30b2c15

Browse files
authored
fix: expose arch var for image (#14)
* fix: expose arch var for image * format
1 parent b5f25ac commit 30b2c15

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ locals {
2121
compute_region_zones = length(var.compute_instance_availability_zones) == 0 ? data.google_compute_zones.in_region.names : var.compute_instance_availability_zones
2222
}
2323

24-
# Fetch most recent COS image
24+
# Fetch most recent Ubuntu image based on architecture
2525
data "google_compute_image" "ubuntu" {
26-
family = "ubuntu-2404-lts"
26+
family = "ubuntu-2404-lts-${var.compute_instance_architecture}"
2727
project = "ubuntu-os-cloud"
2828
}
2929

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ variable "compute_instance_type" {
3333
type = string
3434
}
3535

36+
variable "compute_instance_architecture" {
37+
type = string
38+
default = "amd64"
39+
description = "The architecture of the compute instance (amd64 or arm64)"
40+
41+
validation {
42+
condition = contains(["amd64", "arm64"], var.compute_instance_architecture)
43+
error_message = "Architecture must be either 'amd64' or 'arm64'."
44+
}
45+
}
46+
3647
variable "compute_provision_public_ipv4_address" {
3748
type = bool
3849
default = true

0 commit comments

Comments
 (0)