Skip to content

Commit

Permalink
(fix): Fixed application segment pra and inspection (#375)
Browse files Browse the repository at this point in the history
* (fix): Fixed application segment pra and inspection

* (fix): Upgrade to zscaler-sdk-go v2.1.3

* (Fix): Fixed zpa custom pagination search mechanism via SDK v2.1.3
  • Loading branch information
willguibr authored Oct 6, 2023
1 parent cc42c74 commit 6a87fea
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 135 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:

schedule:
- cron: '0 13 * * 1-5' # UTC
workflow_dispatch:

jobs:
zpa-qa-tenant01:
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 3.0.3 (October, xx 2023)

### Notes

- Release date: **(October, xx 2023)**
- Supported Terraform version: **v1.x**

### Fixes

- [PR #375](https://github.com/zscaler/terraform-provider-zpa/pull/375) - Fixed drift issues in ``zpa_application_segment_pra`` and ``zpa_application_segment_inspection`` when setting up ``apps_config`` options.
- [PR #375](https://github.com/zscaler/terraform-provider-zpa/pull/375) - Upgrade to [Zscaler-SDK-GO v2.1.3](https://github.com/zscaler/zscaler-sdk-go/releases/tag/v2.1.3). The upgrade allows searches for resources in which the name include 1 or more spaces.


## 3.0.2 (September, 30 2023)

### Notes
Expand Down
6 changes: 3 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ testacc:
build13: GOOS=$(shell go env GOOS)
build13: GOARCH=$(shell go env GOARCH)
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
build13: DESTINATION=$(APPDATA)/terraform.d/plugins/$(ZPA_PROVIDER_NAMESPACE)/3.0.2/$(GOOS)_$(GOARCH)
build13: DESTINATION=$(APPDATA)/terraform.d/plugins/$(ZPA_PROVIDER_NAMESPACE)/3.0.3/$(GOOS)_$(GOARCH)
else
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(ZPA_PROVIDER_NAMESPACE)/3.0.2/$(GOOS)_$(GOARCH)
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(ZPA_PROVIDER_NAMESPACE)/3.0.3/$(GOOS)_$(GOARCH)
endif
build13: fmtcheck
go mod tidy && go mod vendor
@echo "==> Installing plugin to $(DESTINATION)"
@mkdir -p $(DESTINATION)
go build -o $(DESTINATION)/terraform-provider-zpa_v3.0.2
go build -o $(DESTINATION)/terraform-provider-zpa_v3.0.3

lint: vendor
@echo "✓ Linting source code with https://staticcheck.io/ ..."
Expand Down
14 changes: 13 additions & 1 deletion docs/guides/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@ Track all ZPA Terraform provider's releases. New resources, features, and bug fi

---

``Last updated: v3.0.2``
``Last updated: v3.0.3``

---

## 3.0.3 (October, xx 2023)

### Notes

- Release date: **(October, xx 2023)**
- Supported Terraform version: **v1.x**

### Fixes

- [PR #375](https://github.com/zscaler/terraform-provider-zpa/pull/375) - Fixed drift issues in ``zpa_application_segment_pra`` and ``zpa_application_segment_inspection`` when setting up ``apps_config`` options.
- [PR #375](https://github.com/zscaler/terraform-provider-zpa/pull/375) - Upgrade to [Zscaler-SDK-GO v2.1.3](https://github.com/zscaler/zscaler-sdk-go/releases/tag/v2.1.3). The upgrade allows searches for resources in which the name include 1 or more spaces.

## 3.0.2 (September, 30 2023)

### Notes
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/zpa_application_segment_inspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The following arguments are supported:
* `application_protocol` - (Required) Protocol for the Inspection Application Segment.. Supported values: `HTTP` and `HTTPS`
* `application_port` - (Required) Port for the Inspection Application Segment.
* `app_types` - (Required) Indicates the type of application as inspection. Supported value: `INSPECT`
* `certificate_id` - (string) - ID of the signing certificate. This field is required if the applicationProtocol is set to `HTTPS`. The certificateId is not supported if the applicationProtocol is set to `HTTP`.
* `certificate_id` - (string) - ID of the signing certificate. This field is required if the ``application_protocol`` is set to `HTTPS`. The ``certificate_id`` is **NOT** supported if the application_protocol is set to `HTTP`.
* `enabled` - (Optional) Whether this application is enabled or not
* `tcp_port_ranges` - (Required) TCP port ranges used to access the app.
* `udp_port_ranges` - (Required) UDP port ranges used to access the app.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-sdk v1.17.2
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
github.com/zscaler/zscaler-sdk-go/v2 v2.1.1
github.com/zscaler/zscaler-sdk-go/v2 v2.1.3
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ github.com/zclconf/go-cty v1.14.0 h1:/Xrd39K7DXbHzlisFP9c4pHao4yyf+/Ug9LEz+Y/yhc
github.com/zclconf/go-cty v1.14.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
github.com/zclconf/go-cty-yaml v1.0.2/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0=
github.com/zscaler/zscaler-sdk-go/v2 v2.1.1 h1:7PpU0fLUCJIx8R8ZIMnjwrWBrQPG6mtm2wdyRgmSlEE=
github.com/zscaler/zscaler-sdk-go/v2 v2.1.1/go.mod h1:PQscsdJVbmOXn7xqkRz3MdwYrt2UGHg37ZlON77iptg=
github.com/zscaler/zscaler-sdk-go/v2 v2.1.3 h1:DKFlvNVGXGgHTQjggj0kFs7S9IGGoP2ICc+svbn8E4A=
github.com/zscaler/zscaler-sdk-go/v2 v2.1.3/go.mod h1:PQscsdJVbmOXn7xqkRz3MdwYrt2UGHg37ZlON77iptg=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
Expand Down
48 changes: 34 additions & 14 deletions zpa/data_source_zpa_machine_group_test.go
Original file line number Diff line number Diff line change
@@ -1,40 +1,60 @@
package zpa

import (
"fmt"
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

var machineGroupNames = []string{
"BD-MGR01", "BD-MGR02", "BD MGR 03", "BD MGR 04", "BD MGR 05",
"BD MGR06", "BD MGR 07", "BD M GR 08", "BD M GR 09",
}

func TestAccDataSourceMachineGroup_Basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccCheckDataSourceMachineGroup_basic,
Config: testAccCheckDataSourceMachineGroup_basic(),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceMachineGroupCheck("data.zpa_machine_group.bd_mgr01"),
testAccDataSourceMachineGroupCheck("data.zpa_machine_group.bd_mgr02"),
generateMachineGroupChecks()...,
),
},
},
})
}

func testAccDataSourceMachineGroupCheck(name string) resource.TestCheckFunc {
return resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(name, "id"),
resource.TestCheckResourceAttrSet(name, "name"),
)
func generateMachineGroupChecks() []resource.TestCheckFunc {
var checks []resource.TestCheckFunc
for _, name := range machineGroupNames {
resourceName := createValidResourceName(name)
checkName := fmt.Sprintf("data.zpa_machine_group.%s", resourceName)
checks = append(checks, resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(checkName, "id"),
resource.TestCheckResourceAttrSet(checkName, "name"),
))
}
return checks
}

var testAccCheckDataSourceMachineGroup_basic = `
data "zpa_machine_group" "bd_mgr01" {
name = "BD-MGR01"
func testAccCheckDataSourceMachineGroup_basic() string {
var configs string
for _, name := range machineGroupNames {
resourceName := createValidResourceName(name)
configs += fmt.Sprintf(`
data "zpa_machine_group" "%s" {
name = "%s"
}
`, resourceName, name)
}
return configs
}

data "zpa_machine_group" "bd_mgr02" {
name = "BD-MGR02"
// createValidResourceName converts the given name to a valid Terraform resource name
func createValidResourceName(name string) string {
return strings.ReplaceAll(name, " ", "_")
}
`
Loading

0 comments on commit 6a87fea

Please sign in to comment.