diff --git a/CHANGELOG.md b/CHANGELOG.md index 87517ea4..94587b3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,21 @@ # Changelog -## 3.1.0 (January, 17 2023) +## 3.1.1 (February, 28 2024) ### Notes -- Release date: **(January, 17 2023)** +- Release date: **(February, 28 2024)** +- Supported Terraform version: **v1.x** + +### Bug Fixes + +- [PR #423](https://github.com/zscaler/terraform-provider-zpa/pull/423) - Fixed drift issue within `zpa_application_segment_pra` resource + +## 3.1.0 (January, 17 2024) + +### Notes + +- Release date: **(January, 17 2024)** - Supported Terraform version: **v1.x** ### Enhacements diff --git a/docs/guides/release-notes.md b/docs/guides/release-notes.md index 0cfb703c..c2fa1e8e 100644 --- a/docs/guides/release-notes.md +++ b/docs/guides/release-notes.md @@ -12,15 +12,26 @@ Track all ZPA Terraform provider's releases. New resources, features, and bug fi --- -``Last updated: v3.1.0`` +``Last updated: v3.1.1`` --- -## 3.1.0 (January, 17 2023) - Unreleased +## 3.1.1 (February, 28 2024) ### Notes -- Release date: **(January, 17 2023)** +- Release date: **(February, 28 2024)** +- Supported Terraform version: **v1.x** + +### Bug Fixes + +- [PR #423](https://github.com/zscaler/terraform-provider-zpa/pull/423) - Fixed drift issue within `zpa_application_segment_pra` resource + +## 3.1.0 (January, 17 2024) - Unreleased + +### Notes + +- Release date: **(January, 17 2024)** - Supported Terraform version: **v1.x** ### Enhacements diff --git a/zpa/data_source_zpa_posture_profile_test.go b/zpa/data_source_zpa_posture_profile_test.go index 9bc1a8ca..9ee40728 100644 --- a/zpa/data_source_zpa_posture_profile_test.go +++ b/zpa/data_source_zpa_posture_profile_test.go @@ -1,42 +1,53 @@ package zpa import ( + "fmt" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) +var profileNames = []string{ + "CrowdStrike_ZPA_Pre-ZTA", "CrowdStrike_ZPA_ZTA_40", "CrowdStrike_ZPA_ZTA_80", +} + func TestAccDataSourcePostureProfile_Basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckDataSourcePostureProfileConfig_basic, + Config: testAccCheckDataSourcePostureProfile_basic(), Check: resource.ComposeTestCheckFunc( - testAccDataSourcePostureProfileCheck("data.zpa_posture_profile.pre_zta"), - testAccDataSourcePostureProfileCheck("data.zpa_posture_profile.zta_40"), - testAccDataSourcePostureProfileCheck("data.zpa_posture_profile.zta_80"), + generatePostureProfileChecks()..., ), }, }, }) } -func testAccDataSourcePostureProfileCheck(name string) resource.TestCheckFunc { - return resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet(name, "id"), - resource.TestCheckResourceAttrSet(name, "name"), - ) +func generatePostureProfileChecks() []resource.TestCheckFunc { + var checks []resource.TestCheckFunc + for _, name := range profileNames { + resourceName := createValidResourceName(name) + checkName := fmt.Sprintf("data.zpa_posture_profile.%s", resourceName) + checks = append(checks, resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(checkName, "id"), + resource.TestCheckResourceAttrSet(checkName, "name"), + )) + } + return checks } -var testAccCheckDataSourcePostureProfileConfig_basic = ` -data "zpa_posture_profile" "pre_zta" { - name = "CrowdStrike_ZPA_Pre-ZTA (zscalertwo.net)" +func testAccCheckDataSourcePostureProfile_basic() string { + var configs string + for _, name := range profileNames { + resourceName := createValidResourceName(name) + configs += fmt.Sprintf(` +data "zpa_posture_profile" "%s" { + name = "%s" } -data "zpa_posture_profile" "zta_40" { - name = "CrowdStrike_ZPA_ZTA_40 (zscalertwo.net)" +`, resourceName, name) + } + return configs } -data "zpa_posture_profile" "zta_80" { - name = "CrowdStrike_ZPA_ZTA_80 (zscalertwo.net)" -}` diff --git a/zpa/data_source_zpa_scim_group_test.go b/zpa/data_source_zpa_scim_group_test.go index eefa914c..96efc196 100644 --- a/zpa/data_source_zpa_scim_group_test.go +++ b/zpa/data_source_zpa_scim_group_test.go @@ -16,7 +16,6 @@ func TestAccDataSourceScimGroup_Basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccDataSourceScimGroupCheck("data.zpa_scim_groups.engineering"), testAccDataSourceScimGroupCheck("data.zpa_scim_groups.contractors"), - testAccDataSourceScimGroupCheck("data.zpa_scim_groups.marketing"), testAccDataSourceScimGroupCheck("data.zpa_scim_groups.finance"), testAccDataSourceScimGroupCheck("data.zpa_scim_groups.executives"), ), @@ -43,11 +42,6 @@ data "zpa_scim_groups" "contractors" { idp_name = "BD_Okta_Users" } -data "zpa_scim_groups" "marketing" { - name = "Marketing" - idp_name = "BD_Okta_Users" -} - data "zpa_scim_groups" "finance" { name = "Finance" idp_name = "BD_Okta_Users" diff --git a/zpa/data_source_zpa_trusted_network_test.go b/zpa/data_source_zpa_trusted_network_test.go index 028aad15..4544d508 100644 --- a/zpa/data_source_zpa_trusted_network_test.go +++ b/zpa/data_source_zpa_trusted_network_test.go @@ -1,34 +1,53 @@ package zpa import ( + "fmt" "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) +var networkNames = []string{ + "BD-TrustedNetwork01", "BD-TrustedNetwork02", "BD-TrustedNetwork03", "BD Trusted Network 01", +} + func TestAccDataSourceTrustedNetwork_Basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckDataSourceTrustedNetworkConfig_basic, + Config: testAccCheckDataSourceTrustedNetwork_basic(), Check: resource.ComposeTestCheckFunc( - testAccDataSourceTrustedNetworkCheck("data.zpa_trusted_network.trusted_network03"), + generateTrustedNetworkChecks()..., ), }, }, }) } -func testAccDataSourceTrustedNetworkCheck(name string) resource.TestCheckFunc { - return resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet(name, "id"), - resource.TestCheckResourceAttrSet(name, "name"), - ) +func generateTrustedNetworkChecks() []resource.TestCheckFunc { + var checks []resource.TestCheckFunc + for _, name := range networkNames { + resourceName := createValidResourceName(name) + checkName := fmt.Sprintf("data.zpa_trusted_network.%s", resourceName) + checks = append(checks, resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet(checkName, "id"), + resource.TestCheckResourceAttrSet(checkName, "name"), + )) + } + return checks } -var testAccCheckDataSourceTrustedNetworkConfig_basic = ` -data "zpa_trusted_network" "trusted_network03" { - name = "BD-TrustedNetwork03 (zscalertwo.net)" -}` +func testAccCheckDataSourceTrustedNetwork_basic() string { + var configs string + for _, name := range networkNames { + resourceName := createValidResourceName(name) + configs += fmt.Sprintf(` +data "zpa_trusted_network" "%s" { + name = "%s" +} +`, resourceName, name) + } + return configs +} diff --git a/zpa/resource_zpa_lss_config_controller_test.go b/zpa/resource_zpa_lss_config_controller_test.go index 38b8ea59..28035635 100644 --- a/zpa/resource_zpa_lss_config_controller_test.go +++ b/zpa/resource_zpa_lss_config_controller_test.go @@ -169,7 +169,7 @@ resource "%s" "%s" { operator = "OR" operands { object_type = "CLIENT_TYPE" - values = ["zpn_client_type_exporter", "zpn_client_type_ip_anchoring", "zpn_client_type_zapp", "zpn_client_type_edge_connector", "zpn_client_type_machine_tunnel", "zpn_client_type_browser_isolation", "zpn_client_type_slogger", "zpn_client_type_zapp_partner", "zpn_client_type_branch_connector"] + values = ["zpn_client_type_exporter", "zpn_client_type_ip_anchoring", "zpn_client_type_zapp", "zpn_client_type_edge_connector", "zpn_client_type_machine_tunnel", "zpn_client_type_browser_isolation", "zpn_client_type_slogger", "zpn_client_type_branch_connector"] } } conditions { diff --git a/zpa/resource_zpa_policy_access_rule_reorder.go b/zpa/resource_zpa_policy_access_rule_reorder.go index 1f04bcda..4a6d2b3c 100644 --- a/zpa/resource_zpa_policy_access_rule_reorder.go +++ b/zpa/resource_zpa_policy_access_rule_reorder.go @@ -93,7 +93,7 @@ func hasDuplicates(orders map[string]int) (int, []string, bool) { return 0, nil, false } -func getRules(d *schema.ResourceData, zClient *Client) (*RulesOrders, error) { +func getRules(d *schema.ResourceData) (*RulesOrders, error) { policyType := d.Get("policy_type").(string) orders := RulesOrders{ PolicyType: policyType, @@ -116,7 +116,7 @@ func getRules(d *schema.ResourceData, zClient *Client) (*RulesOrders, error) { func resourcePolicyAccessReorderRead(d *schema.ResourceData, m interface{}) error { zClient := m.(*Client) - rulesOrders, err := getRules(d, zClient) + rulesOrders, err := getRules(d) if err != nil { return err } @@ -148,7 +148,7 @@ func resourcePolicyAccessReorderUpdate(d *schema.ResourceData, m interface{}) er // Convert the interface to a client instance. zClient := m.(*Client) // Fetch and sort the rule orders from the provided data. - rules, err := getRules(d, zClient) + rules, err := getRules(d) if err != nil { return err } diff --git a/zpa/resource_zpa_provisioning_key_test.go b/zpa/resource_zpa_provisioning_key_test.go index 867709d0..36ec7787 100644 --- a/zpa/resource_zpa_provisioning_key_test.go +++ b/zpa/resource_zpa_provisioning_key_test.go @@ -152,7 +152,7 @@ resource "%s" "%s" { // resource variables resourcetype.ZPAProvisioningKey, generatedName, - generatedName, + name, provisioningKeyType, strconv.FormatBool(variable.ProvisioningKeyEnabled), usage, @@ -301,7 +301,7 @@ func serviceEdgeGroupProvisioningKeyResourceHCL(generatedName, name, serviceEdge // resource variables resourcetype.ZPAProvisioningKey, generatedName, - generatedName, + name, provisioningKeyType, strconv.FormatBool(variable.ProvisioningKeyEnabled), usage,