terraform-libvirt/stack/computes.tf

44 lines
880 B
Terraform
Raw Normal View History

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