Added Hetzner firewall and fixed addresses
This commit is contained in:
18
servers.tf
18
servers.tf
@@ -2,17 +2,17 @@ resource "hcloud_server" "control_planes" {
|
||||
count = var.servers_num - 1
|
||||
name = "k3s-control-plane-${count.index + 1}"
|
||||
|
||||
image = data.hcloud_image.linux.name
|
||||
server_type = local.control_plane_server_type
|
||||
location = local.server_locations[count.index + 1][1]
|
||||
image = data.hcloud_image.linux.name
|
||||
server_type = var.control_plane_server_type
|
||||
location = var.location
|
||||
ssh_keys = [hcloud_ssh_key.default.id]
|
||||
firewall_ids = [hcloud_firewall.k3s.id]
|
||||
|
||||
ssh_keys = [hcloud_ssh_key.default.id]
|
||||
|
||||
labels = {
|
||||
provisioner = "terraform",
|
||||
engine = "k3s",
|
||||
node_type = "control-plane"
|
||||
k3s_upgrade = "true"
|
||||
"provisioner" = "terraform",
|
||||
"engine" = "k3s",
|
||||
"k3s_upgrade" = "true"
|
||||
}
|
||||
|
||||
user_data = data.template_cloudinit_config.init_cfg.rendered
|
||||
@@ -29,7 +29,7 @@ resource "hcloud_server" "control_planes" {
|
||||
|
||||
provisioner "remote-exec" {
|
||||
inline = [
|
||||
"curl -sfL https://get.k3s.io | K3S_TOKEN=${random_password.k3s_cluster_secret.result} sh -s - server --server https://${local.first_control_plane_ip}:6443 ${var.k3s_extra_args}"
|
||||
"curl -sfL https://get.k3s.io | K3S_TOKEN=${random_password.k3s_cluster_secret.result} sh -s - server --server https://${local.first_control_plane_network_ip}:6443 --node-ip=${cidrhost(hcloud_network.k3s.ip_range, 3 + count.index)} --advertise-address=${cidrhost(hcloud_network.k3s.ip_range, 3 + count.index)} --tls-san=${cidrhost(hcloud_network.k3s.ip_range, 3 + count.index)} ${var.k3s_server_flags}",
|
||||
]
|
||||
|
||||
connection {
|
||||
|
Reference in New Issue
Block a user