From 1c9ff2121cc91521048e13802fa63417d945dd09 Mon Sep 17 00:00:00 2001 From: phaer Date: Mon, 14 Feb 2022 00:24:08 +0100 Subject: [PATCH 1/3] Expose load balancer ip in outputs --- main.tf | 4 ++++ output.tf | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/main.tf b/main.tf index e2c5d26..96378ab 100644 --- a/main.tf +++ b/main.tf @@ -152,3 +152,7 @@ resource "hcloud_placement_group" "k3s" { "engine" = "k3s" } } + +data "hcloud_load_balancer" "traefik" { + name = "traefik" +} diff --git a/output.tf b/output.tf index 59471ea..0bc18c8 100644 --- a/output.tf +++ b/output.tf @@ -8,6 +8,11 @@ output "agents_public_ip" { description = "The public IP addresses of the agent server." } +output "load_balancer_public_ip" { + description = "The public IPv4 address of the Hetzner load balancer" + value = data.hcloud_load_balancer.traefik.ipv4 +} + output "kubeconfig_file" { value = local.kubeconfig_external description = "Kubeconfig file content with external IP address" From 41563fb938179abdf6e6f7ebdec8ba37fb3d7148 Mon Sep 17 00:00:00 2001 From: phaer Date: Mon, 14 Feb 2022 11:14:14 +0100 Subject: [PATCH 2/3] load balancer ip depends on deployed CCM... ...so a finished first control plane, more or less --- main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.tf b/main.tf index 96378ab..bed5ed9 100644 --- a/main.tf +++ b/main.tf @@ -155,4 +155,6 @@ resource "hcloud_placement_group" "k3s" { data "hcloud_load_balancer" "traefik" { name = "traefik" + + depends_on = [ hcloud_server.first_control_plane ] } From 8c40b53d14368568b4c8897fe8a05660dfb550f5 Mon Sep 17 00:00:00 2001 From: phaer Date: Mon, 14 Feb 2022 11:24:30 +0100 Subject: [PATCH 3/3] terraform fmt --- main.tf | 2 +- output.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index bed5ed9..2f3f970 100644 --- a/main.tf +++ b/main.tf @@ -156,5 +156,5 @@ resource "hcloud_placement_group" "k3s" { data "hcloud_load_balancer" "traefik" { name = "traefik" - depends_on = [ hcloud_server.first_control_plane ] + depends_on = [hcloud_server.first_control_plane] } diff --git a/output.tf b/output.tf index 0bc18c8..310a0dd 100644 --- a/output.tf +++ b/output.tf @@ -10,7 +10,7 @@ output "agents_public_ip" { output "load_balancer_public_ip" { description = "The public IPv4 address of the Hetzner load balancer" - value = data.hcloud_load_balancer.traefik.ipv4 + value = data.hcloud_load_balancer.traefik.ipv4 } output "kubeconfig_file" {