From 3443833de1b5fbb805d1e098710e7ab4b8218deb Mon Sep 17 00:00:00 2001 From: Patrick MARIE Date: Sat, 12 Feb 2022 10:14:38 +0100 Subject: [PATCH] Fix indexing empty array --- k8s/output.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/output.tf b/k8s/output.tf index 02beaf9..f5d23c6 100644 --- a/k8s/output.tf +++ b/k8s/output.tf @@ -1,4 +1,4 @@ output "lb-address" { description = "load balancer hosntame" - value = flatten(kubernetes_service.testaroo-lb[0].status[*].load_balancer[*].ingress[*].hostname)[0] + value = length(kubernetes_service.testaroo-lb[*].status[*].load_balancer[*].ingress[*].hostname) > 0 ? flatten(kubernetes_service.testaroo-lb[*].status[*].load_balancer[*].ingress[*].hostname)[0] : "" }