summaryrefslogtreecommitdiff
path: root/libvirt.tf
diff options
context:
space:
mode:
Diffstat (limited to 'libvirt.tf')
-rw-r--r--libvirt.tf17
1 files changed, 12 insertions, 5 deletions
diff --git a/libvirt.tf b/libvirt.tf
index c7cbb5a..d63f72b 100644
--- a/libvirt.tf
+++ b/libvirt.tf
@@ -1,11 +1,18 @@
# Defining VM Volume
-resource "libvirt_volume" "qcow2_vol" {
- name = "${var.nom}.qcow2"
+resource "libvirt_volume" "base" {
+ name = "${var.nom}-base"
pool = "default"
source = var.image
format = "qcow2"
}
+resource "libvirt_volume" "image" {
+ name = "${var.nom}.qcow2"
+ base_volume_id = libvirt_volume.base.id
+ pool = "default"
+ size = 10 * 1024 * 1024 *1024
+}
+
# get user data info
data "template_file" "user_data" {
template = file("${path.module}/cloud_init.cfg")
@@ -35,13 +42,13 @@ resource "libvirt_domain" "vm_domain" {
}
network_interface {
- #network_name = "default"
- bridge = "bridge0"
+ network_name = "default"
+ #bridge = "bridge0"
wait_for_lease = true
}
disk {
- volume_id = libvirt_volume.qcow2_vol.id
+ volume_id = libvirt_volume.image.id
}
cloudinit = libvirt_cloudinit_disk.commoninit.id