From 4069d68374526e039912dd70b2613206438e0d0e Mon Sep 17 00:00:00 2001 From: Tanguy <92095568+tanguynicolas@users.noreply.github.com> Date: Thu, 25 Apr 2024 22:33:39 +0200 Subject: [PATCH] feat: `bgp` block can now be optional (#152) Co-authored-by: Tanguy NICOLAS --- main.tf | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index b9e961a..b44f6b9 100644 --- a/main.tf +++ b/main.tf @@ -35,9 +35,16 @@ resource "google_compute_router" "router" { project = var.project_id region = var.region network = var.network - bgp { - asn = var.router_asn - keepalive_interval = var.router_keepalive_interval + + dynamic "bgp" { + for_each = var.router_asn != null ? [{ + asn = var.router_asn + keepalive_interval = var.router_keepalive_interval + }] : [] + content { + asn = bgp.value.asn + keepalive_interval = bgp.value.keepalive_interval + } } }