Skip to content

Commit

Permalink
fix: Fixed panic with trusted_network attribute in Service Edge Group…
Browse files Browse the repository at this point in the history
… resource
  • Loading branch information
willguibr committed May 24, 2024
1 parent 2459f09 commit 5bcbb9b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ local_test/
local_test/*
acceptance_test.yml
.VSCodeCounter
coverage.out
coverage.html
zpacoverage.out
zpacoverage.html
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 3.3.22 (May, 24 2024)

### Notes

- Release date: **(May, 24 2024)**
- Supported Terraform version: **v1.x**

### Bug Fixes
- [PR #459](/~https://github.com/zscaler/terraform-provider-zpa/pull/459) Fixed panic issue with attribute `trusted_networks` within the resource `zpa_service_edge_group`.

## 3.3.21 (May, 18 2024)

### Notes
Expand Down
6 changes: 3 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ testacc:

test\:integration\:zpa:
@echo "$(COLOR_ZSCALER)Running zpa integration tests...$(COLOR_NONE)"
go test -v -race -cover -coverprofile=coverage.out -covermode=atomic ./zpa -parallel 20 -timeout 60m
go tool cover -html=coverage.out -o coverage.html

go test -v -race -cover -coverprofile=zpacoverage.out -covermode=atomic ./zpa -parallel 1 -timeout 60m
go tool cover -html=zpacoverage.out -o zpacoverage.html
go tool cover -func zpacoverage.out | grep total:

build13: GOOS=$(shell go env GOOS)
build13: GOARCH=$(shell go env GOARCH)
Expand Down
12 changes: 11 additions & 1 deletion docs/guides/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@ Track all ZPA Terraform provider's releases. New resources, features, and bug fi

---

``Last updated: v3.3.21``
``Last updated: v3.3.22``

---

## 3.3.22 (May, 24 2024)

### Notes

- Release date: **(May, 24 2024)**
- Supported Terraform version: **v1.x**

### Bug Fixes
- [PR #459](/~https://github.com/zscaler/terraform-provider-zpa/pull/459) Fixed panic issue with attribute `trusted_networks` within the resource `zpa_service_edge_group`.

## 3.3.21 (May, 18 2024)

### Notes
Expand Down
4 changes: 2 additions & 2 deletions zpa/data_source_zpa_application_segment_by_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ resource "zpa_application_segment_browser_access" "this" {
clientless_apps {
name = "%s-app"
enabled = true
domain = "tests-%s.example.com"
enabled = true
domain = "tests-%s.example.com"
application_protocol = "HTTPS"
application_port = "4445"
certificate_id = data.zpa_ba_certificate.jenkins.id
Expand Down
25 changes: 16 additions & 9 deletions zpa/resource_zpa_service_edge_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,20 +373,27 @@ func expandServiceEdges(d *schema.ResourceData) []serviceedgegroup.ServiceEdges
func expandTrustedNetworks(d *schema.ResourceData) []serviceedgegroup.TrustedNetworks {
trustedNetworksInterface, ok := d.GetOk("trusted_networks")
if ok {
trusteNetwork := trustedNetworksInterface.(*schema.Set)
log.Printf("[INFO] trusted network data: %+v\n", trusteNetwork)
var trusteNetworks []serviceedgegroup.TrustedNetworks
for _, trusteNetwork := range trusteNetwork.List() {
trusteNetwork, _ := trusteNetwork.(map[string]interface{})
if trusteNetwork != nil {
for _, id := range trusteNetwork["id"].([]interface{}) {
trusteNetworks = append(trusteNetworks, serviceedgegroup.TrustedNetworks{
trustedNetworkSet, ok := trustedNetworksInterface.(*schema.Set)
if !ok {
return []serviceedgegroup.TrustedNetworks{}
}
log.Printf("[INFO] trusted network data: %+v\n", trustedNetworkSet)
var trustedNetworks []serviceedgegroup.TrustedNetworks
for _, trustedNetwork := range trustedNetworkSet.List() {
trustedNetworkMap, ok := trustedNetwork.(map[string]interface{})
if ok && trustedNetworkMap != nil {
idSet, ok := trustedNetworkMap["id"].(*schema.Set)
if !ok {
continue
}
for _, id := range idSet.List() {
trustedNetworks = append(trustedNetworks, serviceedgegroup.TrustedNetworks{
ID: id.(string),
})
}
}
}
return trusteNetworks
return trustedNetworks
}

return []serviceedgegroup.TrustedNetworks{}
Expand Down

0 comments on commit 5bcbb9b

Please sign in to comment.