76 lines
1.7 KiB
HCL
76 lines
1.7 KiB
HCL
resource "hcloud_server" "cthulhu_masters" {
|
|
count = 1
|
|
|
|
name = "master-${count.index}"
|
|
image = "rocky-9"
|
|
server_type = "cax11"
|
|
location = "fsn1"
|
|
|
|
backups = true
|
|
shutdown_before_deletion = true
|
|
|
|
firewall_ids = [
|
|
hcloud_firewall.cthulhu_nodes_public.id,
|
|
hcloud_firewall.cthulhu_nodes_private.id,
|
|
]
|
|
|
|
ssh_keys = [data.hcloud_ssh_key.vojtechmares.id]
|
|
|
|
labels = {
|
|
"k8s.node.role" = "master"
|
|
"k8s.node.name" = "master-${count.index}"
|
|
"k8s.cluster.name" = "cthulhu"
|
|
}
|
|
|
|
public_net {
|
|
ipv4_enabled = true
|
|
ipv6_enabled = true
|
|
}
|
|
|
|
network {
|
|
network_id = hcloud_network.cthulhu.id
|
|
ip = cidrhost(hcloud_network_subnet.masters.ip_range, count.index + 1)
|
|
}
|
|
}
|
|
|
|
resource "random_string" "workers_suffix" {
|
|
length = 4
|
|
special = false
|
|
upper = false
|
|
}
|
|
|
|
resource "hcloud_server" "cthulhu_workers" {
|
|
count = 1
|
|
|
|
name = "worker-${random_string.workers_suffix.result}-${count.index}"
|
|
image = "rocky-9"
|
|
server_type = "cpx31"
|
|
location = "fsn1"
|
|
|
|
backups = true
|
|
shutdown_before_deletion = true
|
|
|
|
firewall_ids = [
|
|
hcloud_firewall.cthulhu_nodes_public.id,
|
|
hcloud_firewall.cthulhu_nodes_private.id,
|
|
]
|
|
|
|
ssh_keys = [data.hcloud_ssh_key.vojtechmares.id]
|
|
|
|
labels = {
|
|
"k8s.node.role" = "worker"
|
|
"k8s.node.name" = "worker-${random_string.workers_suffix.result}-${count.index}"
|
|
"k8s.cluster.name" = "cthulhu"
|
|
"k8s.node.pool" = random_string.workers_suffix.result
|
|
}
|
|
|
|
public_net {
|
|
ipv4_enabled = true
|
|
ipv6_enabled = true
|
|
}
|
|
|
|
network {
|
|
network_id = hcloud_network.cthulhu.id
|
|
ip = cidrhost(hcloud_network_subnet.workers.ip_range, count.index + 1)
|
|
}
|
|
}
|