-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
64 lines (51 loc) · 1.19 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
terraform {
required_providers {
libvirt = {
source = "dmacvicar/libvirt"
}
}
}
provider "libvirt" {
uri = "qemu+ssh://[email protected]/system"
}
data "template_file" "user_data" {
template = file("${path.module}/cloud_init.cfg")
}
data "template_file" "network_config" {
template = file("${path.module}/network_config.cfg")
}
resource "libvirt_cloudinit_disk" "test-commoninit" {
name = "test-commoninit.iso"
user_data = data.template_file.user_data.rendered
network_config = data.template_file.network_config.rendered
}
resource "libvirt_volume" "test_disk" {
name = "test_disk.qcow2"
base_volume_name = "rhel-baseos-9.1-x86_64-kvm.qcow2"
pool = "default"
size = "21474836480"
}
resource "libvirt_domain" "test" {
name = "test"
vcpu = 2
memory = "12288"
cloudinit = libvirt_cloudinit_disk.test-commoninit.id
autostart = true
network_interface {
bridge = "lab"
}
disk {
volume_id = libvirt_volume.test_disk.id
}
cpu {
mode = "host-passthrough"
}
console {
type = "pty"
target_port = "0"
target_type = "serial"
}
graphics {
type = "vnc"
}
}