Skip to content
Open
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions source.vmware-iso.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ source "vmware-iso" "preflight" {
headless = "${var.headless}"

guest_os_type = "${local.guest_os_type}"
firmware = var.arch == "arm64" ? "efi" : "bios"

vmx_data = var.arch == "arm64" ? {
"virtualHW.version" = "20"
"vhv.enable" = "TRUE"
"usb.present" = "TRUE"
"usb:1.present" = "TRUE"
"usb:1.deviceType" = "hub"
"usb:1.port" = "1"
} : {}

output_directory = "${var.output_directory}/${var.name}-vmware-iso-preflight"

Expand All @@ -23,6 +33,7 @@ source "vmware-iso" "preflight" {

disk_size = var.disk_size
disk_type_id = var.vmware_disk_type_id
disk_adapter_type = var.arch == "arm64" ? "nvme" : "lsilogic"
cpus = var.cpus
memory = var.memory

Expand All @@ -35,6 +46,18 @@ source "vmware-iso" "preflight" {
source "vmware-iso" "full" {
vm_name = var.name
headless = "${var.headless}"

guest_os_type = "${local.guest_os_type}"
firmware = var.arch == "arm64" ? "efi" : "bios"

vmx_data = var.arch == "arm64" ? {
"virtualHW.version" = "20"
"vhv.enable" = "TRUE"
"usb.present" = "TRUE"
"usb:1.present" = "TRUE"
"usb:1.deviceType" = "hub"
"usb:1.port" = "1"
} : {}

output_directory = "${var.output_directory}/${var.name}-vmware-iso-full"

Expand All @@ -53,6 +76,7 @@ source "vmware-iso" "full" {

disk_size = var.disk_size
disk_type_id = var.vmware_disk_type_id
disk_adapter_type = var.arch == "arm64" ? "nvme" : "lsilogic"
cpus = var.cpus
memory = var.memory

Expand Down
6 changes: 4 additions & 2 deletions variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ locals {
aws_instance_type = var.aws_instance_type != "" ? var.aws_instance_type : "${local.aws_instance_prefix}.xlarge"
aws_ami_filter_name = var.aws_ami_source_filter_name != "" ? var.aws_ami_source_filter_name : "ubuntu/images/*ubuntu-${local.ubuntu_version_short}-${var.arch}-server-*"

ubuntu_images_url = var.ubuntu_images_url != "" ? var.ubuntu_images_url : "https://releases.ubuntu.com/${local.ubuntu_version_short}"
# Different base URLs for different architectures
ubuntu_base_url = var.arch == "arm64" ? "https://cdimage.ubuntu.com/releases/${local.ubuntu_version_short}/release" : "https://releases.ubuntu.com/${local.ubuntu_version_short}"
ubuntu_images_url = var.ubuntu_images_url != "" ? var.ubuntu_images_url : local.ubuntu_base_url
ubuntu_images_iso_filename = var.ubuntu_images_iso_filename != "" ? var.ubuntu_images_iso_filename : "ubuntu-${var.ubuntu_version}-live-server-${var.arch}.iso"

iso_checksum = "file:${local.ubuntu_images_url}/SHA256SUMS"
Expand All @@ -255,5 +257,5 @@ locals {

vmware_vmx_source = var.source_directory != "" ? var.source_directory : "${var.name}-vmware-iso"

guest_os_type = "ubuntu-64"
guest_os_type = var.arch == "arm64" ? "arm-ubuntu-64" : "ubuntu-64"
}