Skip to content

Commit

Permalink
Add custom_url_partial_match to context profile
Browse files Browse the repository at this point in the history
Context profile attributes are missing custom_url_partial_match field
which was added in NSX 4.0

Signed-off-by: Kobi Samoray <ksamoray@vmware.com>
  • Loading branch information
ksamoray committed Mar 7, 2023
1 parent 8a79218 commit 30b2a8a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nsxt/resource_nsxt_policy_context_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ func getContextProfilePolicyAppIDAttributesSchema() *schema.Schema {
Type: schema.TypeString,
},
},
"custom_url_partial_match": {
Type: schema.TypeBool,
Description: "True value for this flag will be treated as a partial match for custom url",
Default: true,
},
"sub_attribute": getPolicyAttributeSubAttributeSchema(),
},
},
Expand Down Expand Up @@ -484,6 +489,7 @@ func fillAttributesInSchema(d *schema.ResourceData, policyAttributes []model.Pol
elem["sub_attribute"] = fillSubAttributesInSchema(policyAttribute.SubAttributes)
}
elem["is_alg_type"] = policyAttribute.IsALGType
elem["custom_url_partial_match"] = policyAttribute.CustomUrlPartialMatch
}
attributes[key] = append(attributes[key], elem)
}
Expand Down
4 changes: 4 additions & 0 deletions nsxt/resource_nsxt_policy_context_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func TestAccResourceNsxtPolicyContextProfile_multipleAttributes(t *testing.T) {
resource.TestCheckResourceAttr(testResourceName, "domain_name.#", "1"),
resource.TestCheckResourceAttr(testResourceName, "url_category.#", "0"),
resource.TestCheckResourceAttrSet(testResourceName, "app_id.0.is_alg_type"),
resource.TestCheckResourceAttrSet(testResourceName, "app_id.0.custom_url_partial_match"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.value.#", "3"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.value.0", "HTTP"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.value.1", "SSH"),
Expand Down Expand Up @@ -176,6 +177,7 @@ func TestAccResourceNsxtPolicyContextProfile_subAttributes(t *testing.T) {
resource.TestCheckResourceAttr(testResourceName, "domain_name.#", "0"),
resource.TestCheckResourceAttr(testResourceName, "url_category.#", "0"),
resource.TestCheckResourceAttrSet(testResourceName, "app_id.0.is_alg_type"),
resource.TestCheckResourceAttrSet(testResourceName, "app_id.0.custom_url_partial_match"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.value.#", "1"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.value.0", "SSL"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.sub_attribute.#", "1"),
Expand All @@ -201,6 +203,7 @@ func TestAccResourceNsxtPolicyContextProfile_subAttributes(t *testing.T) {
resource.TestCheckResourceAttr(testResourceName, "domain_name.#", "0"),
resource.TestCheckResourceAttr(testResourceName, "url_category.#", "0"),
resource.TestCheckResourceAttrSet(testResourceName, "app_id.0.is_alg_type"),
resource.TestCheckResourceAttrSet(testResourceName, "app_id.0.custom_url_partial_match"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.value.#", "1"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.value.0", "CIFS"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.sub_attribute.#", "1"),
Expand All @@ -227,6 +230,7 @@ func TestAccResourceNsxtPolicyContextProfile_subAttributes(t *testing.T) {
resource.TestCheckResourceAttr(testResourceName, "app_id.0.value.#", "1"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.value.0", "SSL"),
resource.TestCheckResourceAttrSet(testResourceName, "app_id.0.is_alg_type"),
resource.TestCheckResourceAttrSet(testResourceName, "app_id.0.custom_url_partial_match"),
resource.TestCheckResourceAttr(testResourceName, "app_id.0.sub_attribute.#", "0"),
),
},
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/policy_context_profile.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ In addition to arguments listed above, the following attributes are exported:
* `path` - The NSX path of the policy resource.
* `app_id`:
* `is_alg_type` - Describes whether the APP_ID value is ALG type or not.
* `custom_url_partial_match` - True value for this flag will be treated as a partial match for custom url

## Importing

Expand Down

0 comments on commit 30b2a8a

Please sign in to comment.