Fix indexing empty array

This commit is contained in:
Patrick MARIE 2022-02-12 10:14:38 +01:00
parent f5b4a7d323
commit 3443833de1

View File

@ -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] : ""
}