From 49a0fd60931c309e359f2fdbae42f3c22ffb72ad Mon Sep 17 00:00:00 2001 From: Florian Nowarre Date: Wed, 21 Sep 2022 14:25:51 +0200 Subject: [PATCH] add var for username in flatcar --- .../hetzner/modules/kubernetes-cluster-flatcar/main.tf | 4 ++-- .../kubernetes-cluster-flatcar/templates/machine.yaml.tmpl | 2 +- .../modules/kubernetes-cluster-flatcar/variables.tf | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/main.tf b/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/main.tf index 4dddbbd4b..fbe02515a 100644 --- a/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/main.tf +++ b/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/main.tf @@ -57,7 +57,7 @@ resource "hcloud_server" "master" { connection { host = self.ipv4_address timeout = "3m" - user = "core" + user = ${var.user} } inline = [ @@ -114,7 +114,7 @@ resource "hcloud_server" "worker" { connection { host = self.ipv4_address timeout = "3m" - user = "core" + user = ${var.user} } inline = [ diff --git a/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/templates/machine.yaml.tmpl b/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/templates/machine.yaml.tmpl index 9ddc77564..eb91d0f4b 100644 --- a/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/templates/machine.yaml.tmpl +++ b/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/templates/machine.yaml.tmpl @@ -1,7 +1,7 @@ --- passwd: users: - - name: core + - name: ${user} ssh_authorized_keys: ${ssh_keys} storage: files: diff --git a/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/variables.tf b/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/variables.tf index e47162dc8..35fa8a60e 100644 --- a/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/variables.tf +++ b/contrib/terraform/hetzner/modules/kubernetes-cluster-flatcar/variables.tf @@ -8,6 +8,11 @@ variable "prefix" { default = "k8s" } +variable "user" { + type = string + default = "core" +} + variable "machines" { type = map(object({ node_type = string @@ -16,6 +21,8 @@ variable "machines" { })) } + + variable "ssh_public_keys" { type = list(string) }