diff --git a/aci_tenants.tf b/aci_tenants.tf index ae95287a..ce6fb774 100644 --- a/aci_tenants.tf +++ b/aci_tenants.tf @@ -1030,7 +1030,7 @@ locals { preference = try(sr.preference, local.defaults.apic.tenants.l3outs.node_profiles.nodes.static_routes.preference) bfd = try(sr.bfd, local.defaults.apic.tenants.l3outs.node_profiles.nodes.static_routes.bfd) track_list = try("${sr.track_list}${local.defaults.apic.tenants.policies.track_lists.name_suffix}", null) - next_hops = [for nh in try(sr.next_hops, []) : { + next_hops = [for nh in length(try(sr.next_hops, [])) > 0 ? try(sr.next_hops, []) : [{ ip = "0.0.0.0/0", type = "none", description = null, preference = 0, ip_sla_policy = null, track_list = null }] : { ip = nh.ip description = try(nh.description, "") preference = try(nh.preference, local.defaults.apic.tenants.l3outs.node_profiles.nodes.static_routes.next_hops.preference) @@ -1129,7 +1129,7 @@ locals { preference = try(sr.preference, local.defaults.apic.tenants.l3outs.nodes.static_routes.preference) bfd = try(sr.bfd, local.defaults.apic.tenants.l3outs.node_profiles.nodes.static_routes.bfd) track_list = try("${sr.track_list}${local.defaults.apic.tenants.policies.track_lists.name_suffix}", null) - next_hops = [for nh in try(sr.next_hops, []) : { + next_hops = [for nh in length(try(sr.next_hops, [])) > 0 ? try(sr.next_hops, []) : [{ ip = "0.0.0.0/0", type = "none", description = null, preference = 0, ip_sla_policy = null, track_list = null }] : { ip = nh.ip description = try(nh.description, "") preference = try(nh.preference, local.defaults.apic.tenants.l3outs.nodes.static_routes.next_hops.preference) diff --git a/modules/terraform-aci-l3out-node-profile/README.md b/modules/terraform-aci-l3out-node-profile/README.md index e50f247e..c8ac070e 100644 --- a/modules/terraform-aci-l3out-node-profile/README.md +++ b/modules/terraform-aci-l3out-node-profile/README.md @@ -31,12 +31,13 @@ module "aci_l3out_node_profile" { description = "Default Route" preference = 10 bfd = true - next_hops = [{ - ip = "3.3.3.3" - description = "Next Hop Description" - preference = 10 - type = "prefix" - track_list = "TRACK_LIST1" + next_hops = [ + { + ip = "3.3.3.3" + description = "Next Hop Description" + preference = 10 + type = "prefix" + track_list = "TRACK_LIST1" }, { ip = "5.5.5.5" @@ -44,8 +45,17 @@ module "aci_l3out_node_profile" { preference = 10 type = "prefix" ip_sla_policy = "IP_SLA_POLICY1" + track_list = "TRACK_LIST1" } ] + }, + { + prefix = "192.168.1.1/32" + next_hops = [{ + ip = "0.0.0.0/0" + preference = 0 + type = "none" + }] }] }] bgp_peers = [{ diff --git a/modules/terraform-aci-l3out-node-profile/examples/complete/README.md b/modules/terraform-aci-l3out-node-profile/examples/complete/README.md index 4c87d352..29bd4bd1 100644 --- a/modules/terraform-aci-l3out-node-profile/examples/complete/README.md +++ b/modules/terraform-aci-l3out-node-profile/examples/complete/README.md @@ -34,12 +34,13 @@ module "aci_l3out_node_profile" { description = "Default Route" preference = 10 bfd = true - next_hops = [{ - ip = "3.3.3.3" - description = "Next Hop Description" - preference = 10 - type = "prefix" - track_list = "TRACK_LIST1" + next_hops = [ + { + ip = "3.3.3.3" + description = "Next Hop Description" + preference = 10 + type = "prefix" + track_list = "TRACK_LIST1" }, { ip = "5.5.5.5" @@ -47,8 +48,17 @@ module "aci_l3out_node_profile" { preference = 10 type = "prefix" ip_sla_policy = "IP_SLA_POLICY1" + track_list = "TRACK_LIST1" } ] + }, + { + prefix = "192.168.1.1/32" + next_hops = [{ + ip = "0.0.0.0/0" + preference = 0 + type = "none" + }] }] }] bgp_peers = [{ diff --git a/modules/terraform-aci-l3out-node-profile/examples/complete/main.tf b/modules/terraform-aci-l3out-node-profile/examples/complete/main.tf index df9e9c14..0815ef3e 100644 --- a/modules/terraform-aci-l3out-node-profile/examples/complete/main.tf +++ b/modules/terraform-aci-l3out-node-profile/examples/complete/main.tf @@ -20,12 +20,13 @@ module "aci_l3out_node_profile" { description = "Default Route" preference = 10 bfd = true - next_hops = [{ - ip = "3.3.3.3" - description = "Next Hop Description" - preference = 10 - type = "prefix" - track_list = "TRACK_LIST1" + next_hops = [ + { + ip = "3.3.3.3" + description = "Next Hop Description" + preference = 10 + type = "prefix" + track_list = "TRACK_LIST1" }, { ip = "5.5.5.5" @@ -33,8 +34,17 @@ module "aci_l3out_node_profile" { preference = 10 type = "prefix" ip_sla_policy = "IP_SLA_POLICY1" + track_list = "TRACK_LIST1" } ] + }, + { + prefix = "192.168.1.1/32" + next_hops = [{ + ip = "0.0.0.0/0" + preference = 0 + type = "none" + }] }] }] bgp_peers = [{ @@ -65,4 +75,4 @@ module "aci_l3out_node_profile" { export_route_control = "ERC" import_route_control = "IRC" }] -} +} \ No newline at end of file