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 "agents" {
count = var.agents_num
name = "k3s-agent-${count.index}"
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, 513 + 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, 513 + count.index)
server_type = var.control_plane_server_type
labels = {
"provisioner" = "terraform",
@@ -55,12 +56,14 @@ resource "null_resource" "agents" {
inline = local.install_k3s_agent
}
# Upon reboot verify that k3s agent starts correctly
# Start the k3s agent and wait for it to have started
provisioner "remote-exec" {
inline = [
"systemctl start k3s-agent",
<<-EOT
timeout 120 bash <<EOF
until systemctl status k3s-agent > /dev/null; do
systemctl start k3s-agent
echo "Waiting for the k3s agent to start..."
sleep 2
done