/
main.tf
155 lines (138 loc) · 3.82 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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
provider "linode" {
token = var.token
}
resource "linode_domain" "hegedus_wtf" {
type = "master"
domain = "hegedus.wtf"
soa_email = var.soa_email
}
resource "linode_domain_record" "k3s_hegedus_wtf" {
count = length(linode_instance.k3s_server)
name = "*.k3s"
record_type = "A"
domain_id = linode_domain.hegedus_wtf.id
target = linode_instance.k3s_server[count.index].ip_address
}
resource "linode_instance" "ghost" {
label = "wbhegedus.me"
region = var.region
tags = [
"personal",
"blog"
]
type = "g6-nanode-1"
config {
kernel = "linode/grub2"
label = "My Debian 10 Disk Profile"
memory_limit = 0
root_device = "/dev/sda"
run_level = "default"
virt_mode = "paravirt"
devices {
sda {
disk_label = "Debian 10 Disk"
volume_id = 0
}
sdb {
disk_label = "512 MB Swap Image"
volume_id = 0
}
}
}
disk {
filesystem = "ext4"
label = "Debian 10 Disk"
read_only = false
size = 25088
}
disk {
filesystem = "swap"
label = "512 MB Swap Image"
read_only = false
size = 512
}
}
resource "linode_instance" "salt_master" {
label = "salt-master.${linode_domain.hegedus_wtf.domain}"
region = var.region
private_ip = true
tags = ["work"]
type = "g6-nanode-1"
config {
kernel = "linode/grub2"
label = "My Debian 10 Disk Profile"
memory_limit = 0
root_device = "/dev/sda"
run_level = "default"
virt_mode = "paravirt"
devices {
sda {
disk_label = "Debian 10 Disk"
volume_id = 0
}
sdb {
disk_label = "512 MB Swap Image"
volume_id = 0
}
}
}
disk {
filesystem = "ext4"
label = "Debian 10 Disk"
read_only = false
size = 25088
}
disk {
filesystem = "swap"
label = "512 MB Swap Image"
read_only = false
size = 512
}
}
// TODO: Disable swap
resource "linode_instance" "k3s_server" {
count = 1
image = "linode/debian11"
label = "k3s-server${count.index + 1}.hegedus.wtf"
group = "k3s"
region = var.region
type = "g6-standard-2"
authorized_keys = [var.authorized_keys]
root_pass = var.root_pass
tags = ["work"]
}
resource "linode_domain_record" "k3s_server" {
count = length(linode_instance.k3s_server)
domain_id = linode_domain.hegedus_wtf.id
name = trimsuffix(linode_instance.k3s_server[count.index].label, ".${linode_domain.hegedus_wtf.domain}")
target = linode_instance.k3s_server[count.index].ip_address
record_type = "A"
}
resource "linode_rdns" "k3s_server" {
count = length(linode_instance.k3s_server)
address = linode_instance.k3s_server[count.index].ip_address
rdns = linode_instance.k3s_server[count.index].label
}
resource "linode_instance" "k3s_agent" {
count = 2
image = "linode/debian11"
label = "k3s-agent${count.index + 1}.hegedus.wtf"
group = "k3s-agents"
region = var.region
type = "g6-standard-2"
authorized_keys = [var.authorized_keys]
root_pass = var.root_pass
tags = ["work"]
}
resource "linode_domain_record" "k3s_agent" {
count = length(linode_instance.k3s_agent)
domain_id = linode_domain.hegedus_wtf.id
name = trimsuffix(linode_instance.k3s_agent[count.index].label, ".${linode_domain.hegedus_wtf.domain}")
target = linode_instance.k3s_agent[count.index].ip_address
record_type = "A"
}
resource "linode_rdns" "k3s_agent" {
count = length(linode_instance.k3s_agent)
address = linode_instance.k3s_agent[count.index].ip_address
rdns = linode_instance.k3s_agent[count.index].label
}