Closed rvvliet78 closed 2 months ago
I'm not very familiar with updating code, but it seems that the error is on line 165 of file https://github.com/vmware/terraform-provider-nsxt/blob/master/nsxt/resource_nsxt_policy_tier0_inter_vrf_routing.go
Where it states: inFilter = interface2StringList(brlMap["out_filter"].([]interface{})) This should be outFilter = interface2StringList(brlMap["out_filter"].([]interface{}))
if bpgRouteLeakingList != nil { for _, brl := range bpgRouteLeakingList.([]interface{}) { brlMap := brl.(map[string]interface{}) addressFamily := brlMap["address_family"].(string) var inFilter []string if brlMap["in_filter"] != nil { inFilter = interface2StringList(brlMap["in_filter"].([]interface{})) } var outFilter []string if brlMap["out_filter"] != nil { inFilter = interface2StringList(brlMap["out_filter"].([]interface{})) } bgpRouteLeaking = append(bgpRouteLeaking, model.BgpRouteLeaking{ AddressFamily: &addressFamily, InFilter: inFilter, OutFilter: outFilter, })
I'm not very familiar with updating code, but it seems that the error is on line 165 of file https://github.com/vmware/terraform-provider-nsxt/blob/master/nsxt/resource_nsxt_policy_tier0_inter_vrf_routing.go
Where it states: inFilter = interface2StringList(brlMap["out_filter"].([]interface{})) This should be outFilter = interface2StringList(brlMap["out_filter"].([]interface{}))
if bpgRouteLeakingList != nil { for _, brl := range bpgRouteLeakingList.([]interface{}) { brlMap := brl.(map[string]interface{}) addressFamily := brlMap["address_family"].(string) var inFilter []string if brlMap["in_filter"] != nil { inFilter = interface2StringList(brlMap["in_filter"].([]interface{})) } var outFilter []string if brlMap["out_filter"] != nil { inFilter = interface2StringList(brlMap["out_filter"].([]interface{})) } bgpRouteLeaking = append(bgpRouteLeaking, model.BgpRouteLeaking{ AddressFamily: &addressFamily, InFilter: inFilter, OutFilter: outFilter, })
Seems like you nailed the issue, I can update the code. Thanks for reporting and looking into!
Describe the bug
When adding an in_filter to the bgp_route_leaking it isn't getting applied. However when adding only an out_filter, it gets applied as an in_filter
Reproduction steps
Code `resource "nsxt_policy_tier0_inter_vrf_routing" "inter-vrf-routing_tenant" { display_name = "${nsxt_policy_tier0_gateway.vrftenant-tier0.display_name}-inter-vrf-route" gateway_path = nsxt_policy_tier0_gateway.vrftenant-tier0.path target_path = data.nsxt_policy_tier0_gateway.parent_tier0_vrf_gateway.path
bgp_route_leaking { address_family = "IPV4" in_filter = [nsxt_policy_gateway_route_map.routemap_in.path] out_filter = [nsxt_policy_gateway_route_map.routemap_out.path] } }`
Apply `Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place
Terraform will perform the following actions:
module.vrf_tenant.nsxt_policy_tier0_inter_vrf_routing.inter-vrf-routing_tenant will be updated in-place ~ resource "nsxt_policy_tier0_inter_vrf_routing" "inter-vrf-routing_tenant" { id = "da3e067a-7152-4794-84cb-53c21cafc277"
(6 unchanged attributes hidden)
Plan: 0 to add, 1 to change, 0 to destroy. module.vrf_tenant.nsxt_policy_tier0_inter_vrf_routing.inter-vrf-routing_tenant: Modifying... [id=da3e067a-7152-4794-84cb-53c21cafc277] module.vrf_tenant.nsxt_policy_tier0_inter_vrf_routing.inter-vrf-routing_tenant: Modifications complete after 0s [id=da3e067a-7152-4794-84cb-53c21cafc277]`
Please note the ID of the "out_filter" : 19153ec6-dbd0-4c70-8e45-fcc1f2e754c8
Result:
{ "results": [ { "target_path": "/infra/tier-0s/b4d6feca-a512-4e49-a4d4-e7e6a2a2236b", "bgp_route_leaking": [ { "address_family": "IPV4", "in_filter": [ "/infra/tier-0s/84f40d06-72a2-44c2-adb6-913fd11def9c/route-maps/19153ec6-dbd0-4c70-8e45-fcc1f2e754c8" ] } ], "resource_type": "PolicyInterVrfRoutingConfig", "id": "da3e067a-7152-4794-84cb-53c21cafc277", "display_name": "t04-tst-0006-tstaz2-t0vrf-inter-vrf-route", "tags": [], "path": "/infra/tier-0s/84f40d06-72a2-44c2-adb6-913fd11def9c/inter-vrf-routing/da3e067a-7152-4794-84cb-53c21cafc277", "relative_path": "da3e067a-7152-4794-84cb-53c21cafc277", "parent_path": "/infra/tier-0s/84f40d06-72a2-44c2-adb6-913fd11def9c", "remote_path": "", "unique_id": "89f9f734-e863-43e0-93bf-0555102d516c", "realization_id": "89f9f734-e863-43e0-93bf-0555102d516c", "owner_id": "09a5c149-d345-45cb-9134-54219c6560a0", "marked_for_delete": false, "overridden": false, "_create_time": 1715850082008, "_create_user": "********", "_last_modified_time": 1715859997772, "_last_modified_user": "******", "_system_owned": false, "_protection": "NOT_PROTECTED", "_revision": 14 } ], "result_count": 1, "sort_by": "display_name", "sort_ascending": true }
Expected behavior
"bgp_route_leaking": [ { "address_family": "IPV4", "in_filter": ["/infra/tier-0s/84f40d06-72a2-44c2-adb6-913fd11def9c/route-maps/3f0de474-ee94-460c-9b14-e7375db56561"] "out_filter": [ "/infra/tier-0s/84f40d06-72a2-44c2-adb6-913fd11def9c/route-maps/19153ec6-dbd0-4c70-8e45-fcc1f2e754c8" ] } ],
Additional context
I've tested this agains nsx 4.1.1.0.0.22224312 and provider version: "3.6.1"