diff --git a/dynamic_values/address_prefixes.tf b/dynamic_values/address_prefixes.tf index 5cda027b..97c09b0d 100644 --- a/dynamic_values/address_prefixes.tf +++ b/dynamic_values/address_prefixes.tf @@ -10,7 +10,7 @@ module "prefix_map" { { zone_name = zone addresses = [ - for address in(lookup(var.address_prefixes, zone, null) == null ? [] : var.address_prefixes[zone]) : + for address in(var.address_prefixes != null ? lookup(var.address_prefixes, zone, null) == null ? [] : var.address_prefixes[zone] : []) : { name = "${var.prefix}-${zone}-${index(var.address_prefixes[zone], address) + 1}" cidr = address diff --git a/main.tf b/main.tf index 97077309..6c2a50ae 100644 --- a/main.tf +++ b/main.tf @@ -81,6 +81,7 @@ resource "ibm_is_public_gateway" "gateway" { vpc = ibm_is_vpc.vpc.id resource_group = var.resource_group_id zone = each.value + tags = var.tags } ############################################################################## diff --git a/subnet.tf b/subnet.tf index 05523c40..6cd67f74 100644 --- a/subnet.tf +++ b/subnet.tf @@ -38,6 +38,7 @@ resource "ibm_is_subnet" "subnet" { ipv4_cidr_block = length(keys(local.address_prefixes)) == 0 ? ibm_is_vpc_address_prefix.subnet_prefix[each.value.prefix_name].cidr : each.value.cidr network_acl = ibm_is_network_acl.network_acl[each.value.acl].id public_gateway = each.value.public_gateway + tags = var.tags depends_on = [ibm_is_vpc_address_prefix.address_prefixes] }