Merge branch 'master' into modules

This commit is contained in:
Marco Nenciarini
2022-02-20 11:30:07 +01:00
10 changed files with 79 additions and 98 deletions

View File

@@ -4,15 +4,16 @@ module "control_planes" {
count = var.servers_num - 1
name = "k3s-control-plane-${count.index + 1}"
ssh_keys = [hcloud_ssh_key.k3s.id]
public_key = var.public_key
private_key = var.private_key
firewall_ids = [hcloud_firewall.k3s.id]
placement_group_id = hcloud_placement_group.k3s.id
location = var.location
network_id = hcloud_network.k3s.id
ip = cidrhost(hcloud_network_subnet.k3s.ip_range, 258 + count.index)
server_type = var.control_plane_server_type
ssh_keys = [hcloud_ssh_key.k3s.id]
public_key = var.public_key
private_key = var.private_key
additional_public_keys = var.additional_public_keys
firewall_ids = [hcloud_firewall.k3s.id]
placement_group_id = hcloud_placement_group.k3s.id
location = var.location
network_id = hcloud_network.k3s.id
ip = cidrhost(hcloud_network_subnet.k3s.ip_range, 258 + count.index)
server_type = var.control_plane_server_type
labels = {
"provisioner" = "terraform",
@@ -61,13 +62,14 @@ resource "null_resource" "control_planes" {
inline = local.install_k3s_server
}
# Upon reboot verify that the k3s server starts correctly
# Start the k3s server and wait for it to have started correctly
provisioner "remote-exec" {
inline = [
"systemctl start k3s",
<<-EOT
timeout 120 bash <<EOF
until systemctl status k3s > /dev/null; do
systemctl start k3s
echo "Waiting for the k3s server to start..."
sleep 2
done