diff --git a/agents.tf b/agents.tf index 8ca5cc7..16f0f05 100644 --- a/agents.tf +++ b/agents.tf @@ -27,9 +27,10 @@ resource "hcloud_server" "agents" { destination = "/tmp/config.yaml" connection { - user = "root" - private_key = file(var.private_key) - host = self.ipv4_address + user = "root" + private_key = var.private_key == null ? null : file(var.private_key) + agent_identity = var.private_key == null ? file(var.public_key) : null + host = self.ipv4_address } } @@ -38,9 +39,10 @@ resource "hcloud_server" "agents" { inline = local.k3os_install_commands connection { - user = "root" - private_key = file(var.private_key) - host = self.ipv4_address + user = "root" + private_key = var.private_key == null ? null : file(var.private_key) + agent_identity = var.private_key == null ? file(var.public_key) : null + host = self.ipv4_address } } diff --git a/master.tf b/master.tf index 8da0368..ec7cf25 100644 --- a/master.tf +++ b/master.tf @@ -23,9 +23,10 @@ resource "hcloud_server" "first_control_plane" { destination = "/tmp/config.yaml" connection { - user = "root" - private_key = file(var.private_key) - host = self.ipv4_address + user = "root" + private_key = var.private_key == null ? null : file(var.private_key) + agent_identity = var.private_key == null ? file(var.public_key) : null + host = self.ipv4_address } } @@ -34,9 +35,10 @@ resource "hcloud_server" "first_control_plane" { inline = local.k3os_install_commands connection { - user = "root" - private_key = file(var.private_key) - host = self.ipv4_address + user = "root" + private_key = var.private_key == null ? null : file(var.private_key) + agent_identity = var.private_key == null ? file(var.public_key) : null + host = self.ipv4_address } } diff --git a/servers.tf b/servers.tf index 1510017..bb0cfbb 100644 --- a/servers.tf +++ b/servers.tf @@ -26,9 +26,10 @@ resource "hcloud_server" "control_planes" { destination = "/tmp/config.yaml" connection { - user = "root" - private_key = file(var.private_key) - host = self.ipv4_address + user = "root" + private_key = var.private_key == null ? null : file(var.private_key) + agent_identity = var.private_key == null ? file(var.public_key) : null + host = self.ipv4_address } } @@ -37,9 +38,10 @@ resource "hcloud_server" "control_planes" { inline = local.k3os_install_commands connection { - user = "root" - private_key = file(var.private_key) - host = self.ipv4_address + user = "root" + private_key = var.private_key == null ? null : file(var.private_key) + agent_identity = var.private_key == null ? file(var.public_key) : null + host = self.ipv4_address } }