Skip to content

Commit

Permalink
Merge pull request #640 from vmware/route-map-realization-fix
Browse files Browse the repository at this point in the history
Fix realization issue in gateway route map
  • Loading branch information
annakhm authored Jun 18, 2021
2 parents 9e44d1b + 0ce2c2e commit 2d6c85d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 1 addition & 3 deletions nsxt/policy_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,7 @@ func buildQueryStringFromMap(query map[string]string) string {
}
keyValues := make([]string, 0, len(query))
for key, value := range query {
if strings.Contains(value, "/") {
value = strings.Replace(value, "/", "\\/", -1)
}
value = strings.Replace(value, "/", "\\/", -1)
keyValue := strings.Join([]string{key, value}, ":")
keyValues = append(keyValues, keyValue)
}
Expand Down
8 changes: 6 additions & 2 deletions nsxt/resource_nsxt_policy_gateway_route_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,18 @@ func policyGatewayRouteMapBuildEntry(schemaEntry map[string]interface{}) model.R
weight := int64(data["weight"].(int))

entrySet := model.RouteMapEntrySet{
AsPathPrepend: &asPathPrepend,
Community: &community,
LocalPreference: &localPreference,
Med: &med,
PreferGlobalV6NextHop: &globalIPv6,
Weight: &weight,
}

if len(asPathPrepend) > 0 {
entrySet.AsPathPrepend = &asPathPrepend
}
if len(community) > 0 {
entrySet.Community = &community
}
obj.Set = &entrySet
}

Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/policy_gateway_route_map.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ resource "nsxt_policy_gateway_route_map" "test" {
action = "PERMIT"
community_list_match {
criteria = "11:*"
match_operator = "MATCH_COMMUNITY_REGEX"
match_operator = "COMMUNITY_REGEX"
}
community_list_match {
criteria = "11:*"
match_operator = "MATCH_LARGE_COMMUNITY_REGEX"
match_operator = "LARGE_COMMUNITY_REGEX"
}
}
Expand Down

0 comments on commit 2d6c85d

Please sign in to comment.