@@ -12,6 +12,7 @@ Terraform module for KVM/Libvirt Virtual Machine. This module will create a KVM
12
12
- one NIC per domain, connected to the network using the ** bridge interface**
13
13
- setup network interface using DHCP or static configuration
14
14
- cloud_init VM(s) configuration (Ubuntu+Netplan complient)
15
+ - optionally add multiple extra disks
15
16
- test the ssh connection
16
17
17
18
## Tested on
@@ -80,6 +81,7 @@ No modules.
80
81
| <a name =" output_ip_address " ></a > [ ip\_ address] ( #output\_ ip\_ address ) | n/a |
81
82
| <a name =" output_name " ></a > [ name] ( #output\_ name ) | n/a |
82
83
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
84
+
83
85
## Example
84
86
85
87
Example with enable HugePages, Attached USB device, changed USB controller model... :
@@ -100,7 +102,7 @@ provider "libvirt" {
100
102
101
103
module "vm" {
102
104
source = "MonolithProjects/vm/libvirt"
103
- version = "1.6 .0"
105
+ version = "1.8 .0"
104
106
105
107
vm_hostname_prefix = "server"
106
108
vm_count = 3
@@ -158,7 +160,7 @@ provider "libvirt" {
158
160
159
161
module "vm" {
160
162
source = "MonolithProjects/vm/libvirt"
161
- version = "1.6 .0"
163
+ version = "1.8 .0"
162
164
163
165
vm_hostname_prefix = "server"
164
166
vm_count = 3
@@ -197,7 +199,45 @@ output "outputs" {
197
199
}
198
200
```
199
201
200
- The shared directory from the example can be mounted inside the VM with command ` sudo mount -t 9p -o trans=virtio,version=9p2000.L,rw tmp /host/tmp `
202
+ > The shared directory from the example can be mounted inside the VM with command ` sudo mount -t 9p -o trans=virtio,version=9p2000.L,rw tmp /host/tmp `
203
+
204
+ Create a VM with an extra disk
205
+
206
+ ```
207
+ # Creates a 50GB extra-data-disk within vms pool
208
+ resource "libvirt_volume" "data_volume" {
209
+ pool = "vms"
210
+ name = "extra-data-disk.qcow2"
211
+ format = "qcow2"
212
+ size = 1024*1024*1024*50
213
+ }
214
+
215
+ module "vm" {
216
+ source = "MonolithProjects/vm/libvirt"
217
+ version = "1.8.0"
218
+
219
+ vm_hostname_prefix = "data-server"
220
+ base_volume_name = "debian-11-base.qcow2"
221
+ base_pool_name = "linked-images"
222
+ vm_count = 1
223
+ bridge = "bridge-dmz"
224
+ memory = "4096"
225
+ vcpu = 4
226
+ pool = "vms"
227
+ system_volume = 25
228
+ additional_disk_ids = [ libvirt_volume.data_volume.id ]
229
+ dhcp = true
230
+ ssh_admin = "admin"
231
+ ssh_keys = [
232
+ chomp(file("~/.ssh/id_rsa.pub"))
233
+ ]
234
+ time_zone = "America/Argentina/Buenos_Aires"
235
+ }
236
+
237
+ output "ip_addresses" {
238
+ value = module.vm
239
+ }
240
+ ```
201
241
202
242
## Module output example
203
243
0 commit comments