main.tf (5194B)
1 provider "libvirt" { 2 uri = var.libvirt_uri 3 } 4 5 module "ori_network" { 6 source = "../../modules/libvirt_network" 7 8 network_bridge_interface = "virbr1" 9 network_name = "ori_network" 10 network_cidr = ["192.168.144.0/24"] 11 network_dns_enabled = false 12 } 13 14 resource "libvirt_volume" "base_debian_volume" { 15 name = "debian_base_volume" 16 pool = var.libvirt_storage_pool 17 format = "qcow2" 18 source = "/home/bsd/Disks/packer-debian10-base-v2" 19 } 20 21 resource "libvirt_volume" "base_debian_volume_v3" { 22 name = "debian_base_volume_v3" 23 pool = var.libvirt_storage_pool 24 format = "qcow2" 25 source = "/home/bsd/Disks/packer-debian10-base-v6" 26 } 27 28 resource "libvirt_volume" "base_openbsd_volume" { 29 name = "openbsd_base_volume" 30 pool = var.libvirt_storage_pool 31 format = "qcow2" 32 source = "/home/bsd/Disks/packer-openbsd6.8-base" 33 } 34 35 module "dirty_debian_dev" { 36 source = "../../modules/libvirt_host" 37 38 host_name = "dirty_debian_dev" 39 host_memory = "1024" 40 host_vcpu = 2 41 storage_pool = var.libvirt_storage_pool 42 volume_name = "dirty_debian_dev" 43 base_volume_id = libvirt_volume.base_debian_volume.id 44 disks = [{ "volume_id" : libvirt_volume.base_debian_volume.id }] 45 network_id = module.ori_network.id 46 network_cidr = module.ori_network.cidr[0] 47 network_host = "2" 48 enable_cloud_init = true 49 cloudinit_user_template = <<EOF 50 runcmd: 51 - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces 52 EOF 53 } 54 55 module "nv_core" { 56 source = "../../modules/libvirt_host" 57 58 host_name = "nv_core" 59 host_memory = "1024" 60 host_vcpu = 1 61 storage_pool = var.libvirt_storage_pool 62 volume_name = "nv_core" 63 volume_size = "21474836480" 64 base_volume_id = libvirt_volume.base_debian_volume_v3.id 65 disks = [{ "volume_id" : libvirt_volume.base_debian_volume_v3.id }] 66 network_id = module.ori_network.id 67 network_cidr = module.ori_network.cidr[0] 68 network_host = "3" 69 enable_cloud_init = true 70 cloudinit_user_template = <<EOF 71 runcmd: 72 - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces 73 EOF 74 } 75 76 module "openbsd_68" { 77 source = "../../modules/libvirt_host" 78 79 host_name = "openbsd68" 80 host_memory = "512" 81 host_vcpu = 1 82 storage_pool = var.libvirt_storage_pool 83 volume_name = "openbsd_68" 84 base_volume_id = libvirt_volume.base_openbsd_volume.id 85 disks = [{ "volume_id" : libvirt_volume.base_openbsd_volume.id }] 86 network_id = module.ori_network.id 87 network_cidr = module.ori_network.cidr[0] 88 network_host = "4" 89 enable_cloud_init = false 90 host_autostart = false 91 } 92 93 module "xorg_enabled" { 94 source = "../../modules/libvirt_host" 95 96 host_name = "xorg_enabled" 97 host_memory = "1024" 98 host_vcpu = 1 99 storage_pool = var.libvirt_storage_pool 100 volume_name = "xorg_enabled" 101 base_volume_id = libvirt_volume.base_debian_volume.id 102 disks = [{ "volume_id" : libvirt_volume.base_debian_volume.id }] 103 network_id = module.ori_network.id 104 network_cidr = module.ori_network.cidr[0] 105 network_host = "5" 106 enable_cloud_init = true 107 cloudinit_user_template = <<EOF 108 runcmd: 109 - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces 110 EOF 111 } 112 113 module "rust_dev" { 114 source = "../../modules/libvirt_host" 115 116 host_name = "rust_dev" 117 host_memory = "1024" 118 host_vcpu = 2 119 storage_pool = var.libvirt_storage_pool 120 volume_name = "rust_dev" 121 base_volume_id = libvirt_volume.base_debian_volume.id 122 disks = [{ "volume_id" : libvirt_volume.base_debian_volume.id }] 123 network_id = module.ori_network.id 124 network_cidr = module.ori_network.cidr[0] 125 network_host = "7" 126 host_autostart = false 127 enable_cloud_init = true 128 cloudinit_user_template = <<EOF 129 runcmd: 130 - echo 'source /etc/network/interfaces.d/*' > /etc/network/interfaces 131 EOF 132 } 133 134 module "kali_live" { 135 source = "../../modules/libvirt_host" 136 137 host_name = "kali_live" 138 host_memory = "4096" 139 host_vcpu = 4 140 storage_pool = var.libvirt_storage_pool 141 disks = [{ "iso" : "/home/bsd/Disks/kali-linux-2020.4-live-amd64.iso" }] 142 network_id = module.ori_network.id 143 network_cidr = module.ori_network.cidr[0] 144 network_host = "22" 145 enable_graphics = true 146 host_autostart = false 147 } 148 149 module "tails_live" { 150 source = "../../modules/libvirt_host" 151 152 host_name = "tails_live" 153 host_memory = "2048" 154 host_vcpu = 2 155 storage_pool = var.libvirt_storage_pool 156 disks = [{ "iso" : "/home/bsd/Disks/tails-amd64-4.14.iso" }] 157 network_id = module.ori_network.id 158 network_cidr = module.ori_network.cidr[0] 159 network_host = "23" 160 enable_graphics = true 161 host_autostart = false 162 }