aboutsummaryrefslogtreecommitdiffstats
path: root/openbsd-image
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-image')
-rw-r--r--openbsd-image/openbsd-amd64.pkr.hcl4
-rw-r--r--openbsd-image/openbsd-arm64.pkr.hcl4
-rw-r--r--openbsd-image/variables.pkr.hcl10
3 files changed, 14 insertions, 4 deletions
diff --git a/openbsd-image/openbsd-amd64.pkr.hcl b/openbsd-image/openbsd-amd64.pkr.hcl
index 7cbb24b..03e55e2 100644
--- a/openbsd-image/openbsd-amd64.pkr.hcl
+++ b/openbsd-image/openbsd-amd64.pkr.hcl
@@ -1,5 +1,5 @@
source "qemu" "openbsd-amd64" {
- vm_name = "openbsd-${var.version}-amd64.raw"
+ vm_name = "openbsd-${var.version}-amd64.${var.disk_format}"
iso_url = "${var.mirror}/pub/OpenBSD/${var.version}/${var.arch}/install${local.version_short}.iso"
iso_checksum = "file:${var.mirror}/pub/OpenBSD/${var.version}/${var.arch}/SHA256"
output_directory = "build"
@@ -12,7 +12,7 @@ source "qemu" "openbsd-amd64" {
disk_interface = "virtio"
disk_size = "${var.disk_size}G"
disk_compression = true
- format = "raw"
+ format = var.disk_format
ssh_username = "root"
ssh_password = local.root_password
ssh_timeout = "30m"
diff --git a/openbsd-image/openbsd-arm64.pkr.hcl b/openbsd-image/openbsd-arm64.pkr.hcl
index 3749486..b4d170c 100644
--- a/openbsd-image/openbsd-arm64.pkr.hcl
+++ b/openbsd-image/openbsd-arm64.pkr.hcl
@@ -1,5 +1,5 @@
source "qemu" "openbsd-arm64" {
- vm_name = "openbsd-${var.version}-aarch64.qcow2"
+ vm_name = "openbsd-${var.version}-aarch64.${var.disk_format}"
iso_url = "${var.mirror}/pub/OpenBSD/${var.version}/${var.arch}/install${local.version_short}.iso"
iso_checksum = "file:${var.mirror}/pub/OpenBSD/${var.version}/${var.arch}/SHA256"
output_directory = "build"
@@ -12,7 +12,7 @@ source "qemu" "openbsd-arm64" {
disk_interface = "virtio"
disk_size = "${var.disk_size}G"
disk_compression = true
- format = "qcow2"
+ format = var.disk_format
ssh_username = "root"
ssh_password = local.root_password
ssh_timeout = "10m"
diff --git a/openbsd-image/variables.pkr.hcl b/openbsd-image/variables.pkr.hcl
index 24fdbd1..6cd1c3a 100644
--- a/openbsd-image/variables.pkr.hcl
+++ b/openbsd-image/variables.pkr.hcl
@@ -60,6 +60,16 @@ variable "disk_size" {
default = 16
}
+variable "disk_format" {
+ type = string
+ description = "Format of the disk for the VM image"
+ default = "qcow2"
+ validation {
+ condition = contains(["raw", "qcow2"], var.disk_format)
+ error_message = "The arch must be one of: raw, qcow2."
+ }
+}
+
variable "disklabel_template" {
type = string
description = "Specify a custom disklabel template. If empty (default), we'll use OpenBSD's default automatic layout."