You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
resource "libvirt_volume" "win_disk" {
|
|
name = "${format(var.windows_hostname_format, count.index + 1)}.${var.volume_format}"
|
|
count = var.windows_machine_count
|
|
format = var.volume_format
|
|
pool = var.pool_name
|
|
base_volume_name = "${var.windows_image}.${var.volume_format}"
|
|
}
|
|
|
|
resource "libvirt_domain" "win_machine" {
|
|
count = var.windows_machine_count
|
|
name = format(var.windows_hostname_format, count.index + 1)
|
|
vcpu = "2"
|
|
memory = "2048"
|
|
|
|
cpu = {
|
|
mode = "host-passthrough"
|
|
}
|
|
|
|
disk {
|
|
volume_id = element(libvirt_volume.win_disk.*.id, count.index)
|
|
}
|
|
|
|
network_interface {
|
|
network_id = libvirt_network.lab_net.id
|
|
hostname = format(var.windows_hostname_format, count.index + 1)
|
|
|
|
# When creating the domain resource, wait until the network interface gets
|
|
# a DHCP lease from libvirt, so that the computed IP addresses will be
|
|
# available when the domain is up and the plan applied.
|
|
wait_for_lease = true
|
|
}
|
|
}
|
|
|
|
locals {
|
|
windows_machines = { for i in libvirt_domain.win_machine : i.name => i.network_interface.0.addresses[0] }
|
|
}
|
|
|