-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.tf
79 lines (63 loc) · 1.51 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
provider "libvirt" {
uri = "qemu+ssh://${var.virt_host}:22/system?socket=/var/run/libvirt/libvirt-sock"
}
resource "libvirt_pool" "base" {
name = "base"
type = "dir"
path = "/var/lib/libvirt/images/base"
}
resource "libvirt_pool" "default" {
name = "default"
type = "dir"
path = "/var/lib/libvirt/images/default"
}
resource "libvirt_pool" "longhorn" {
name = "longhorn"
type = "dir"
path = "/mnt/longhorn"
}
resource "libvirt_volume" "ubuntu_20_04" {
name = "ubuntu_20_04"
pool = libvirt_pool.base.name
source = "https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.img"
}
resource "libvirt_network" "k3s_network" {
name = "br0"
mode = "bridge"
bridge = var.bridge_name
autostart = true
}
module "k3s_cluster" {
source = "./modules/cluster"
name = "k3s"
base_volume = libvirt_volume.ubuntu_20_04
storage_pool = libvirt_pool.default
boot_volume_size = 50000000000
pv_storage_pool = libvirt_pool.longhorn
pv_volume_size = 300000000000
sudo_password = var.sudo_password
k3s_token = var.k3s_token
k3s_master_hostname = var.k3s_master_hostname
network_bridge = libvirt_network.k3s_network
ips = [
"10.2.1.10",
"10.2.1.11",
"10.2.1.12",
]
macs = [
"92:2F:BA:CA:04:A9",
"92:2F:BA:CA:00:F7",
"92:2F:BA:CA:0D:9C",
]
gpu_guids = [
"",
"",
"88524b2f-6380-42e2-9c92-832c9191f898"
]
}
output "ips" {
value = module.k3s_cluster.ips
}
terraform {
required_version = ">= 0.12"
}