add var for username in flatcar

This commit is contained in:
Florian Nowarre 2022-09-21 14:25:51 +02:00
parent 73ff8144c2
commit 49a0fd6093
3 changed files with 10 additions and 3 deletions

View file

@ -57,7 +57,7 @@ resource "hcloud_server" "master" {
connection { connection {
host = self.ipv4_address host = self.ipv4_address
timeout = "3m" timeout = "3m"
user = "core" user = ${var.user}
} }
inline = [ inline = [
@ -114,7 +114,7 @@ resource "hcloud_server" "worker" {
connection { connection {
host = self.ipv4_address host = self.ipv4_address
timeout = "3m" timeout = "3m"
user = "core" user = ${var.user}
} }
inline = [ inline = [

View file

@ -1,7 +1,7 @@
--- ---
passwd: passwd:
users: users:
- name: core - name: ${user}
ssh_authorized_keys: ${ssh_keys} ssh_authorized_keys: ${ssh_keys}
storage: storage:
files: files:

View file

@ -8,6 +8,11 @@ variable "prefix" {
default = "k8s" default = "k8s"
} }
variable "user" {
type = string
default = "core"
}
variable "machines" { variable "machines" {
type = map(object({ type = map(object({
node_type = string node_type = string
@ -16,6 +21,8 @@ variable "machines" {
})) }))
} }
variable "ssh_public_keys" { variable "ssh_public_keys" {
type = list(string) type = list(string)
} }