resource "hcloud_server" "first_control_plane" { name = "k3s-control-plane-0" image = data.hcloud_image.linux.name server_type = local.control_plane_server_type location = local.server_locations[0][1] ssh_keys = [hcloud_ssh_key.default.id] labels = { provisioner = "terraform", engine = "k3s", node_type = "control-plane" k3s_upgrade = "true" } user_data = data.template_cloudinit_config.init_cfg.rendered provisioner "remote-exec" { inline = var.initial_commands connection { user = "root" private_key = file(var.private_key) host = self.ipv4_address } } provisioner "remote-exec" { inline = [ "curl -sfL https://get.k3s.io | K3S_TOKEN=${random_password.k3s_cluster_secret.result} sh -s - server --cluster-init ${var.k3s_extra_args}", "until systemctl is-active --quiet k3s.service; do sleep 1; done", "until kubectl get node ${self.name}; do sleep 1; done", "kubectl -n kube-system create secret generic hcloud --from-literal=token=${var.hcloud_token} --from-literal=network=${hcloud_network.k3s.name}", "kubectl apply -f -<