terraform-libvirt/stack/computes.tf

51 lines
1.0 KiB
HCL

# https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/domain.html.markdown
# Define KVM domain to create
resource "libvirt_domain" "db1" {
name = "db1"
memory = "1024"
vcpu = 1
running = "false"
autostart = "true"
boot_device {
dev = ["hd", "network"]
}
network_interface {
network_name = "default"
# network_name = libvirt_network.private_network.name
}
disk {
volume_id = libvirt_volume.debian_buster_qcow2.id
}
# disk {
# volume_id = libvirt_volume.external_disk_1.id
# }
cloudinit = libvirt_cloudinit_disk.commoninit.id
console {
type = "pty"
target_type = "serial"
target_port = "0"
}
graphics {
type = "vnc"
listen_type = "address"
autoport = "true"
}
}
resource "libvirt_volume" "debian_buster_qcow2" {
name = "debian-buster.qcow2"
pool = "default"
source = "https://cdimage.debian.org/cdimage/openstack/current/debian-10.4.3-20200610-openstack-amd64.qcow2"
format = "qcow2"
}