Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion main-infra.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ resource "tls_private_key" "ssh" {
algorithm = "ED25519"
}

resource "local_sensitive_file" "ssh" {
resource "local_sensitive_file" "ssh_private" {
content = tls_private_key.ssh.private_key_openssh
filename = abspath("${path.root}/files/id_ed25519")
}

resource "local_sensitive_file" "ssh_public" {
content = tls_private_key.ssh.public_key_openssh
filename = abspath("${path.root}/files/id_ed25519.pub")
}

resource "hcloud_ssh_key" "default" {
name = var.name
public_key = tls_private_key.ssh.public_key_openssh
Expand Down
4 changes: 2 additions & 2 deletions main-setup.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource "null_resource" "k3sup_control" {
provisioner "local-exec" {
command = <<-EOT
k3sup install --print-config=false \
--ssh-key='${local_sensitive_file.ssh.filename}' \
--ssh-key='${local_sensitive_file.ssh_private.filename}' \
--ip='${hcloud_server.control.ipv4_address}' \
--k3s-channel='${var.k3s_channel}' \
--k3s-extra-args="\
Expand Down Expand Up @@ -78,7 +78,7 @@ resource "null_resource" "k3sup_worker" {
provisioner "local-exec" {
command = <<-EOT
k3sup join \
--ssh-key='${local_sensitive_file.ssh.filename}' \
--ssh-key='${local_sensitive_file.ssh_private.filename}' \
--ip='${hcloud_server.worker[count.index].ipv4_address}' \
--server-ip='${hcloud_server.control.ipv4_address}' \
--k3s-channel='${var.k3s_channel}' \
Expand Down
9 changes: 9 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "ssh_private_key_filename" {
description = "Path to the private SSH Key"
value = local_sensitive_file.ssh_private.filename
}

output "ssh_public_key_filename" {
description = "Path to the public SSH Key"
value = local_sensitive_file.ssh_public.filename
}