From 4e73f7209fcdec7f7a87e8bb0fd6150a5a5dd470 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Fri, 24 Jan 2025 23:44:11 +0100 Subject: [PATCH] test(packer): add cpu & ram internal variable. --- tests/packer/archlinux.pkr.hcl | 4 ++-- tests/packer/debian.pkr.hcl | 4 ++-- tests/packer/opensuse.pkr.hcl | 4 ++-- tests/packer/ubuntu.pkr.hcl | 8 ++++---- tests/packer/variables.pkr.hcl | 12 ++++++++++++ 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/tests/packer/archlinux.pkr.hcl b/tests/packer/archlinux.pkr.hcl index 88a5a1cb..06f2ad3a 100644 --- a/tests/packer/archlinux.pkr.hcl +++ b/tests/packer/archlinux.pkr.hcl @@ -8,8 +8,8 @@ source "qemu" "archlinux" { iso_checksum = "file:https://geo.mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-cloudimg.qcow2.SHA256" iso_target_path = "${var.iso_dir}/archlinux-cloudimg-amd64.img" cpu_model = "host" - cpus = 6 - memory = 4096 + cpus = var.cpus + memory = var.ram disk_size = var.disk_size accelerator = "kvm" headless = true diff --git a/tests/packer/debian.pkr.hcl b/tests/packer/debian.pkr.hcl index d45ed3d3..12d4a513 100644 --- a/tests/packer/debian.pkr.hcl +++ b/tests/packer/debian.pkr.hcl @@ -8,8 +8,8 @@ source "qemu" "debian" { iso_checksum = "file:https://cdimage.debian.org/images/cloud/${var.release.debian.codename}/latest/SHA512SUMS" iso_target_path = "${var.iso_dir}/debian-${var.release.debian.codename}-cloudimg-amd64.img" cpu_model = "host" - cpus = 6 - memory = 4096 + cpus = var.cpus + memory = var.ram disk_size = var.disk_size accelerator = "kvm" headless = true diff --git a/tests/packer/opensuse.pkr.hcl b/tests/packer/opensuse.pkr.hcl index 29649d4b..46cf4af2 100644 --- a/tests/packer/opensuse.pkr.hcl +++ b/tests/packer/opensuse.pkr.hcl @@ -10,8 +10,8 @@ source "qemu" "opensuse" { iso_checksum = "sha256:223ed62160ef4f1a4f21b69c574f552a07eee6ef66cf66eef2b49c5a7c4864f4" iso_target_path = "${var.base_dir}/base-tumbleweed-gnome.qcow2" cpu_model = "host" - cpus = 6 - memory = 4096 + cpus = var.cpus + memory = var.ram disk_size = var.disk_size accelerator = "kvm" headless = false diff --git a/tests/packer/ubuntu.pkr.hcl b/tests/packer/ubuntu.pkr.hcl index f6981806..3689882a 100644 --- a/tests/packer/ubuntu.pkr.hcl +++ b/tests/packer/ubuntu.pkr.hcl @@ -8,8 +8,8 @@ source "qemu" "ubuntu22" { iso_checksum = "file:https://cloud-images.ubuntu.com/${var.release.ubuntu22.codename}/current/SHA256SUMS" iso_target_path = "${var.iso_dir}/ubuntu-${var.release.ubuntu22.codename}-cloudimg-amd64.img" cpu_model = "host" - cpus = 6 - memory = 4096 + cpus = var.cpus + memory = var.ram disk_size = var.disk_size accelerator = "kvm" headless = true @@ -45,8 +45,8 @@ source "qemu" "ubuntu24" { iso_checksum = "file:https://cloud-images.ubuntu.com/${var.release.ubuntu24.codename}/current/SHA256SUMS" iso_target_path = "${var.iso_dir}/ubuntu-${var.release.ubuntu24.codename}-cloudimg-amd64.img" cpu_model = "host" - cpus = 6 - memory = 4096 + cpus = var.cpus + memory = var.ram disk_size = var.disk_size accelerator = "kvm" headless = true diff --git a/tests/packer/variables.pkr.hcl b/tests/packer/variables.pkr.hcl index 82251f25..0361698d 100644 --- a/tests/packer/variables.pkr.hcl +++ b/tests/packer/variables.pkr.hcl @@ -22,6 +22,18 @@ variable "ssh_publickey" { default = "~/.ssh/id_ed25519.pub" } +variable "cpus" { + description = "Default CPU of the VM" + type = string + default = "6" +} + +variable "ram" { + description = "Default RAM of the VM" + type = string + default = "4096" +} + variable "disk_size" { description = "Disk size of the VM to build" type = string