Skip to content

Commit

Permalink
Fix server list in server groups (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
willguibr authored Feb 18, 2023
1 parent 8e254d3 commit bd4667d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ build: fmtcheck
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)/2.6.0/$(GOOS)_$(GOARCH)
build13: DESTINATION=$(APPDATA)/terraform.d/plugins/$(ZPA_PROVIDER_NAMESPACE)/2.6.1/$(GOOS)_$(GOARCH)
else
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(ZPA_PROVIDER_NAMESPACE)/2.6.0/$(GOOS)_$(GOARCH)
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(ZPA_PROVIDER_NAMESPACE)/2.6.1/$(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_v2.6.0
go build -o $(DESTINATION)/terraform-provider-zpa_v2.6.1

test: fmtcheck
go test $(TEST) || exit 1
Expand Down
10 changes: 5 additions & 5 deletions zpa/resource_zpa_server_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func resourceServerGroup() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeSet,
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -315,12 +315,12 @@ func expandApplicationServers(d *schema.ResourceData) []servergroup.ApplicationS
applicationServersInterface, ok := d.GetOk("servers")
if ok {
applicationServer := applicationServersInterface.(*schema.Set)
log.Printf("[INFO] servers data: %+v\n", applicationServer)
log.Printf("[INFO] server group application data: %+v\n", applicationServer)
var applicationServers []servergroup.ApplicationServer
for _, applicationServer := range applicationServer.List() {
applicationServer, ok := applicationServer.(map[string]interface{})
if ok {
for _, id := range applicationServer["id"].(*schema.Set).List() {
applicationServer, _ := applicationServer.(map[string]interface{})
if applicationServer != nil {
for _, id := range applicationServer["id"].([]interface{}) {
applicationServers = append(applicationServers, servergroup.ApplicationServer{
ID: id.(string),
})
Expand Down

0 comments on commit bd4667d

Please sign in to comment.