terraform-libvirt/stack/computes.tf

44 lines
880 B
HCL

# https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/domain.html.markdown
# Define KVM domain to create
resource "libvirt_domain" "domains" {
name = format("db%s", count.index)
memory = "1024"
vcpu = 1
running = "true"
autostart = "true"
count = var.number_domain
boot_device {
dev = ["hd", "network"]
}
network_interface {
network_name = libvirt_network.private_network.name
}
disk {
volume_id = element(libvirt_volume.root_debian.*.id, count.index)
}
disk {
volume_id = element(libvirt_volume.external_disk.*.id, count.index)
}
cloudinit = libvirt_cloudinit_disk.commoninit[count.index].id
console {
type = "pty"
target_type = "serial"
target_port = "0"
}
graphics {
type = "vnc"
listen_type = "address"
autoport = "true"
}
}