From b22346ded4ba85bf45e2502f433b8923f6acdaa0 Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Tue, 2 Mar 2021 22:02:48 +0000 Subject: [PATCH] Always allow to specify set in route map criteria Set can be configured regardless of criteria type --- nsxt/resource_nsxt_policy_gateway_route_map.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nsxt/resource_nsxt_policy_gateway_route_map.go b/nsxt/resource_nsxt_policy_gateway_route_map.go index 14ec086e9..4fc62ac90 100644 --- a/nsxt/resource_nsxt_policy_gateway_route_map.go +++ b/nsxt/resource_nsxt_policy_gateway_route_map.go @@ -167,6 +167,7 @@ func policyGatewayRouteMapBuildEntry(schemaEntry map[string]interface{}) model.R } commListMatches := schemaEntry["community_list_match"].([]interface{}) + prefixListMatches := schemaEntry["prefix_list_matches"].(*schema.Set).List() if len(commListMatches) > 0 { var commCriteriaList []model.CommunityMatchCriteria @@ -183,12 +184,11 @@ func policyGatewayRouteMapBuildEntry(schemaEntry map[string]interface{}) model.R } obj.CommunityListMatches = commCriteriaList + } else if len(prefixListMatches) > 0 { + obj.PrefixListMatches = interfaceListToStringList(prefixListMatches) } - prefixListMatches := schemaEntry["prefix_list_matches"].(*schema.Set).List() - if len(prefixListMatches) > 0 { - obj.PrefixListMatches = interfaceListToStringList(prefixListMatches) - } else if len(schemaEntry["set"].([]interface{})) > 0 { + if len(schemaEntry["set"].([]interface{})) > 0 { data := schemaEntry["set"].([]interface{})[0].(map[string]interface{}) asPathPrepend := data["as_path_prepend"].(string) community := data["community"].(string)