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 8, 2023
1 parent d65c3a3 commit 53a8eda
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 @@ -90,6 +90,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 @@ -514,6 +519,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 @@ -172,6 +172,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 @@ -214,6 +215,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 @@ -239,6 +241,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 @@ -265,6 +268,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 @@ -85,6 +85,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 53a8eda

Please sign in to comment.