diff --git a/iac/nomad-cluster-disk-image/setup/install-consul.sh b/iac/nomad-cluster-disk-image/setup/install-consul.sh index c1e4767c97..dd7e7de3a1 100644 --- a/iac/nomad-cluster-disk-image/setup/install-consul.sh +++ b/iac/nomad-cluster-disk-image/setup/install-consul.sh @@ -123,7 +123,7 @@ function install_binary { local -r bin_dir="$install_path/bin" local -r consul_dest_path="$bin_dir/consul" - unzip -d /tmp "$DOWNLOAD_PACKAGE_PATH" + unzip -o -d /tmp "$DOWNLOAD_PACKAGE_PATH" log_info "Moving Consul binary to $consul_dest_path" sudo mv "/tmp/consul" "$consul_dest_path" @@ -243,4 +243,4 @@ function install { fi } -install "$@" \ No newline at end of file +install "$@" diff --git a/iac/nomad-cluster-disk-image/setup/install-nomad.sh b/iac/nomad-cluster-disk-image/setup/install-nomad.sh index 34358b00d7..b8bf550864 100755 --- a/iac/nomad-cluster-disk-image/setup/install-nomad.sh +++ b/iac/nomad-cluster-disk-image/setup/install-nomad.sh @@ -141,7 +141,7 @@ function install_binaries { log_info "Downloading Nomad $version from $url to $download_path" curl -o "$download_path" "$url" - unzip -d /tmp "$download_path" + unzip -o -d /tmp "$download_path" log_info "Moving Nomad binary to $nomad_dest_path" sudo mv "/tmp/nomad" "$nomad_dest_path" diff --git a/iac/provider-aws/nomad-cluster-disk-image/Makefile b/iac/provider-aws/nomad-cluster-disk-image/Makefile index eea0bfa4f3..48248140a2 100644 --- a/iac/provider-aws/nomad-cluster-disk-image/Makefile +++ b/iac/provider-aws/nomad-cluster-disk-image/Makefile @@ -5,7 +5,16 @@ init: packer init -upgrade . build: - packer build -var "prefix=$(PREFIX)" -var "aws_region=$(AWS_REGION)" -var "aws_profile=$(AWS_PROFILE)" -var "vpc_id=$(PACKER_VPC_ID)" -var "subnet_id=$(PACKER_SUBNET_ID)" . + packer build \ + $(if $(PACKER_CONSUL_VERSION),-var "consul_version=$(PACKER_CONSUL_VERSION)") \ + $(if $(PACKER_NOMAD_VERSION),-var "nomad_version=$(PACKER_NOMAD_VERSION)") \ + $(if $(PACKER_VPC_ID),-var "vpc_id=$(PACKER_VPC_ID)") \ + $(if $(PACKER_SUBNET_ID),-var "subnet_id=$(PACKER_SUBNET_ID)") \ + $(if $(PACKER_SOURCE_AMI_FILTER_NAME),-var "source_ami_filter_name=$(PACKER_SOURCE_AMI_FILTER_NAME)") \ + -var "prefix=$(PREFIX)" \ + -var "aws_region=$(AWS_REGION)" \ + -var "aws_profile=$(AWS_PROFILE)" \ + . format: packer fmt . diff --git a/iac/provider-aws/nomad-cluster-disk-image/main.pkr.hcl b/iac/provider-aws/nomad-cluster-disk-image/main.pkr.hcl index 2b593b23ca..fd35da9bf2 100644 --- a/iac/provider-aws/nomad-cluster-disk-image/main.pkr.hcl +++ b/iac/provider-aws/nomad-cluster-disk-image/main.pkr.hcl @@ -24,7 +24,7 @@ source "amazon-ebs" "ubuntu" { // Ubuntu Server 24.04 LTS (HVM), SSD Volume Type source_ami_filter { filters = { - name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*" + name = var.source_ami_filter_name root-device-type = "ebs" virtualization-type = "hvm" } diff --git a/iac/provider-aws/nomad-cluster-disk-image/variables.pkr.hcl b/iac/provider-aws/nomad-cluster-disk-image/variables.pkr.hcl index 4cef65f01c..dad3887547 100644 --- a/iac/provider-aws/nomad-cluster-disk-image/variables.pkr.hcl +++ b/iac/provider-aws/nomad-cluster-disk-image/variables.pkr.hcl @@ -6,6 +6,11 @@ variable "aws_profile" { type = string } +variable "source_ami_filter_name" { + type = string + default = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*" +} + variable "prefix" { type = string } diff --git a/iac/provider-gcp/nomad-cluster-disk-image/Makefile b/iac/provider-gcp/nomad-cluster-disk-image/Makefile index 3eb7a65d02..157565791d 100644 --- a/iac/provider-gcp/nomad-cluster-disk-image/Makefile +++ b/iac/provider-gcp/nomad-cluster-disk-image/Makefile @@ -15,7 +15,15 @@ init: build: terraform init -input=false -reconfigure -backend-config="bucket=${TERRAFORM_STATE_BUCKET}" $(tf_vars) terraform apply -auto-approve -input=false -compact-warnings - packer build -var "gcp_project_id=$(GCP_PROJECT_ID)" -var "gcp_zone=$(GCP_ZONE)" -var "network_name=$(PACKER_NETWORK_NAME)" -var "subnet_name=$(PACKER_SUBNET_NAME)" . + packer build \ + $(if $(PACKER_CONSUL_VERSION),-var "consul_version=$(PACKER_CONSUL_VERSION)") \ + $(if $(PACKER_NOMAD_VERSION),-var "nomad_version=$(PACKER_NOMAD_VERSION)") \ + $(if $(PACKER_NETWORK_NAME),-var "network_name=$(PACKER_NETWORK_NAME)") \ + $(if $(PACKER_SUBNET_NAME),-var "subnet_name=$(PACKER_SUBNET_NAME)") \ + $(if $(PACKER_SOURCE_IMAGE),-var "source_image=$(PACKER_SOURCE_IMAGE)") \ + -var "gcp_project_id=$(GCP_PROJECT_ID)" \ + -var "gcp_zone=$(GCP_ZONE)" \ + . format: packer fmt . diff --git a/iac/provider-gcp/nomad-cluster-disk-image/main.pkr.hcl b/iac/provider-gcp/nomad-cluster-disk-image/main.pkr.hcl index 2a0c3df6f1..36c3f7a439 100644 --- a/iac/provider-gcp/nomad-cluster-disk-image/main.pkr.hcl +++ b/iac/provider-gcp/nomad-cluster-disk-image/main.pkr.hcl @@ -14,7 +14,7 @@ source "googlecompute" "orch" { # TODO: Overwrite the image instead of creating timestamped images every time we build its image_name = "${var.prefix}orch-${formatdate("YYYY-MM-DD-hh-mm-ss", timestamp())}" project_id = var.gcp_project_id - source_image = "ubuntu-2404-noble-amd64-v20260517" + source_image = var.source_image ssh_username = "ubuntu" zone = var.gcp_zone disk_size = 10 diff --git a/iac/provider-gcp/nomad-cluster-disk-image/variables.pkr.hcl b/iac/provider-gcp/nomad-cluster-disk-image/variables.pkr.hcl index 9c22b4e459..1979d52718 100644 --- a/iac/provider-gcp/nomad-cluster-disk-image/variables.pkr.hcl +++ b/iac/provider-gcp/nomad-cluster-disk-image/variables.pkr.hcl @@ -39,3 +39,8 @@ variable "cni_plugin_version" { type = string default = "v1.6.2" } + +variable "source_image" { + type = string + default = "ubuntu-2404-noble-amd64-v20260517" +}