Skip to content

Commit c729e7f

Browse files
author
Andrew Vella
committed
fix: avoid creating hc firewall rule if health_check not defined (#476)
1 parent 34c85bb commit c729e7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ resource "google_compute_health_check" "default" {
433433
}
434434

435435
resource "google_compute_firewall" "default-hc" {
436-
count = length(var.firewall_networks)
436+
count = length(var.firewall_networks) && (length(local.health_checked_backends) > 0) ? 1 : 0
437437
project = length(var.firewall_networks) == 1 && var.firewall_projects[0] == "default" ? var.project : var.firewall_projects[count.index]
438438
name = "${var.name}-hc-${count.index}"
439439
network = var.firewall_networks[count.index]

0 commit comments

Comments
 (0)