Skip to content

Commit 9f7b2bf

Browse files
committed
Add support for multiple additional disks to the VM module
1 parent 5ae2a82 commit 9f7b2bf

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

modules/workloads/vm/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ resource "harvester_virtualmachine" "this" {
3636
auto_delete = true
3737
}
3838

39+
dynamic "disk" {
40+
for_each = var.additional_disks
41+
content {
42+
name = disk.value.name
43+
size = disk.value.size
44+
bus = "virtio"
45+
image = disk.value.image
46+
auto_delete = disk.value.auto_delete
47+
}
48+
}
49+
3950
dynamic "cloudinit" {
4051
for_each = var.user_data != null ? [1] : []
4152
content {

modules/workloads/vm/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,14 @@ variable "wait_for_lease" {
7676
description = "Whether Terraform should wait for an IP lease on the primary NIC. Set to false when using static IPs via cloud-init network_data without qemu-guest-agent."
7777
default = true
7878
}
79+
80+
variable "additional_disks" {
81+
type = list(object({
82+
name = string
83+
size = string
84+
image = optional(string)
85+
auto_delete = optional(bool, true)
86+
}))
87+
description = "List of additional disks to attach to the VM."
88+
default = []
89+
}

0 commit comments

Comments
 (0)