From ec3eb332343ca11348b5572b771a9a5fb2203ec9 Mon Sep 17 00:00:00 2001 From: Avinash-jayakumar <86616574+Avinash-jayakumar@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:37:57 +0530 Subject: [PATCH] fix(modules/panorama): Use of an already reserved external IP (#13) Co-authored-by: michalbil <92343355+michalbil@users.noreply.github.com> --- modules/panorama/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/panorama/main.tf b/modules/panorama/main.tf index 568d742..6b2f8d7 100644 --- a/modules/panorama/main.tf +++ b/modules/panorama/main.tf @@ -17,7 +17,7 @@ resource "google_compute_address" "private" { # Permanent public address, not ephemeral. resource "google_compute_address" "public" { - count = var.attach_public_ip ? 1 : 0 + count = var.attach_public_ip && var.public_static_ip == null ? 1 : 0 name = "${var.name}-public" project = var.project @@ -62,7 +62,7 @@ resource "google_compute_instance" "this" { dynamic "access_config" { for_each = var.attach_public_ip ? [""] : [] content { - nat_ip = google_compute_address.public[0].address + nat_ip = try(var.public_static_ip, google_compute_address.public[0].address) } }