-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathproxmox.tf
135 lines (133 loc) · 3.17 KB
/
proxmox.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# see https://registry.terraform.io/providers/bpg/proxmox/0.68.0/docs/resources/virtual_environment_file
resource "proxmox_virtual_environment_file" "talos" {
datastore_id = "local"
node_name = var.proxmox_pve_node_name
content_type = "iso"
source_file {
path = "tmp/talos/talos-${var.talos_version}.qcow2"
file_name = "talos-${var.talos_version}.img"
}
}
# see https://registry.terraform.io/providers/bpg/proxmox/0.68.0/docs/resources/virtual_environment_vm
resource "proxmox_virtual_environment_vm" "controller" {
count = var.controller_count
name = "${var.prefix}-${local.controller_nodes[count.index].name}"
node_name = var.proxmox_pve_node_name
tags = sort(["talos", "controller", "example", "terraform"])
stop_on_destroy = true
bios = "ovmf"
machine = "q35"
scsi_hardware = "virtio-scsi-single"
operating_system {
type = "l26"
}
cpu {
type = "host"
cores = 4
}
memory {
dedicated = 4 * 1024
}
vga {
type = "qxl"
}
network_device {
bridge = "vmbr0"
}
tpm_state {
version = "v2.0"
}
efi_disk {
datastore_id = "local-lvm"
file_format = "raw"
type = "4m"
}
disk {
datastore_id = "local-lvm"
interface = "scsi0"
iothread = true
ssd = true
discard = "on"
size = 40
file_format = "raw"
file_id = proxmox_virtual_environment_file.talos.id
}
agent {
enabled = true
trim = true
}
initialization {
ip_config {
ipv4 {
address = "${local.controller_nodes[count.index].address}/24"
gateway = var.cluster_node_network_gateway
}
}
}
}
# see https://registry.terraform.io/providers/bpg/proxmox/0.68.0/docs/resources/virtual_environment_vm
resource "proxmox_virtual_environment_vm" "worker" {
count = var.worker_count
name = "${var.prefix}-${local.worker_nodes[count.index].name}"
node_name = var.proxmox_pve_node_name
tags = sort(["talos", "worker", "example", "terraform"])
stop_on_destroy = true
bios = "ovmf"
machine = "q35"
scsi_hardware = "virtio-scsi-single"
operating_system {
type = "l26"
}
cpu {
type = "host"
cores = 4
}
memory {
dedicated = 4 * 1024
}
vga {
type = "qxl"
}
network_device {
bridge = "vmbr0"
}
tpm_state {
version = "v2.0"
}
efi_disk {
datastore_id = "local-lvm"
file_format = "raw"
type = "4m"
}
disk {
datastore_id = "local-lvm"
interface = "scsi0"
iothread = true
ssd = true
discard = "on"
size = 40
file_format = "raw"
file_id = proxmox_virtual_environment_file.talos.id
}
disk {
datastore_id = "local-lvm"
interface = "scsi1"
iothread = true
ssd = true
discard = "on"
size = 60
file_format = "raw"
}
agent {
enabled = true
trim = true
}
initialization {
ip_config {
ipv4 {
address = "${local.worker_nodes[count.index].address}/24"
gateway = var.cluster_node_network_gateway
}
}
}
}