Skip to content

Commit

Permalink
Merge pull request #387 from terraform-providers/fix_bgp_filters
Browse files Browse the repository at this point in the history
Fix route filters in bgp neighbor resource
  • Loading branch information
annakhm authored Jul 10, 2020
2 parents 7e466cc + 5145249 commit 5682ceb
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions nsxt/resource_nsxt_policy_bgp_neighbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,21 @@ func resourceNsxtPolicyBgpNeighborResourceDataToStruct(d *schema.ResourceData, i
}
enabled := data["enabled"].(bool)

var inFilters, outFilters []string
if d.Get("in_route_filter") != nil {
inFilters = append(inFilters, d.Get("in_route_filter").(string))
}
if d.Get("out_route_filter") != nil {
outFilters = append(outFilters, d.Get("out_route_filter").(string))
filterStruct := model.BgpRouteFiltering{
AddressFamily: &addrFamily,
Enabled: &enabled,
}

filterStruct := model.BgpRouteFiltering{
AddressFamily: &addrFamily,
Enabled: &enabled,
InRouteFilters: inFilters,
OutRouteFilters: outFilters,
var inFilters, outFilters []string
inFilter := data["in_route_filter"].(string)
outFilter := data["out_route_filter"].(string)
if len(inFilter) > 0 {
inFilters = append(inFilters, inFilter)
filterStruct.InRouteFilters = inFilters
}
if len(outFilter) > 0 {
outFilters = append(outFilters, outFilter)
filterStruct.OutRouteFilters = outFilters
}

if nsxVersionHigherOrEqual("3.0.0") && data["maximum_routes"] != 0 {
Expand Down

0 comments on commit 5682ceb

Please sign in to comment.