From 1e630317c621fa0dadb9ec90e86cbc46c18d48b8 Mon Sep 17 00:00:00 2001 From: William Guilherme Date: Mon, 11 Dec 2023 09:44:05 -0800 Subject: [PATCH 1/4] Fix: Fixed Pointers to new SDK v2.2.2 structure --- go.mod | 2 +- go.sum | 1 - .../app/zscaler-terraformer/cmd/generate.go | 14 ++++----- .../zscaler-terraformer/cmd/generate_test.go | 30 ++++++++++--------- .../app/zscaler-terraformer/cmd/import.go | 18 +++++------ internal/app/zscaler-terraformer/cmd/type.go | 30 ++++++++++--------- internal/app/zscaler-terraformer/cmd/util.go | 30 ++++++++++--------- .../terraform/zia/zia_admin_users/test.tf | 8 ++--- 8 files changed, 68 insertions(+), 65 deletions(-) diff --git a/go.mod b/go.mod index 5e6e639..fd895ab 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/zscaler/zscaler-terraformer -go 1.19 +go 1.20 require ( github.com/dnaeon/go-vcr v1.2.0 diff --git a/go.sum b/go.sum index 991339b..04f35bf 100644 --- a/go.sum +++ b/go.sum @@ -132,7 +132,6 @@ github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -github.com/zscaler/zscaler-sdk-go v1.7.0 h1:vE0DhIqNMxEnD7AUzSpm66wrWog29LMGBOfdCiRoem4= github.com/zscaler/zscaler-sdk-go/v2 v2.2.2 h1:iY/xxn69DESF1dPuLHrVdhgsdKUwtG6raS56k0r8lf0= github.com/zscaler/zscaler-sdk-go/v2 v2.2.2/go.mod h1:ZuSr5SoINzMxCVQPV1lh5xBEwsQLDmpEznEV9ey+gHg= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= diff --git a/internal/app/zscaler-terraformer/cmd/generate.go b/internal/app/zscaler-terraformer/cmd/generate.go index d6ce4af..b7365d4 100644 --- a/internal/app/zscaler-terraformer/cmd/generate.go +++ b/internal/app/zscaler-terraformer/cmd/generate.go @@ -19,9 +19,9 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" "github.com/zclconf/go-cty/cty" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlpdictionaries" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlpdictionaries" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/filteringrules" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplications" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplicationgroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservices" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlcategories" @@ -473,7 +473,7 @@ func generate(cmd *cobra.Command, writer io.Writer, resourceType string) { m, _ := json.Marshal(jsonPayload) _ = json.Unmarshal(m, &jsonStructData) case "zia_admin_users": - jsonPayload, err := api.zia.adminuserrolemgmt.GetAllAdminUsers() + jsonPayload, err := api.zia.admins.GetAllAdminUsers() if err != nil { log.Fatal(err) } @@ -558,7 +558,7 @@ func generate(cmd *cobra.Command, writer io.Writer, resourceType string) { m, _ := json.Marshal(servicesFiltered) _ = json.Unmarshal(m, &jsonStructData) case "zia_firewall_filtering_network_service_groups": - jsonPayload, err := api.zia.networkservices.GetAllNetworkServiceGroups() + jsonPayload, err := api.zia.networkservicegroups.GetAllNetworkServiceGroups() if err != nil { log.Fatal(err) } @@ -566,11 +566,11 @@ func generate(cmd *cobra.Command, writer io.Writer, resourceType string) { m, _ := json.Marshal(jsonPayload) _ = json.Unmarshal(m, &jsonStructData) case "zia_firewall_filtering_network_application_groups": - groups, err := api.zia.networkapplications.GetAllNetworkApplicationGroups() + groups, err := api.zia.networkapplicationgroups.GetAllNetworkApplicationGroups() if err != nil { log.Fatal(err) } - groupsFiltered := []networkapplications.NetworkApplicationGroups{} + groupsFiltered := []networkapplicationgroups.NetworkApplicationGroups{} for _, group := range groups { if isInList(group.Name, []string{"Microsoft Office365"}) { continue @@ -662,7 +662,7 @@ func generate(cmd *cobra.Command, writer io.Writer, resourceType string) { m, _ := json.Marshal(jsonPayload) _ = json.Unmarshal(m, &jsonStructData) case "zia_user_management": - jsonPayload, err := api.zia.usermanagement.GetAllUsers() + jsonPayload, err := api.zia.users.GetAllUsers() if err != nil { log.Fatal(err) } diff --git a/internal/app/zscaler-terraformer/cmd/generate_test.go b/internal/app/zscaler-terraformer/cmd/generate_test.go index 30cab70..ecf859b 100644 --- a/internal/app/zscaler-terraformer/cmd/generate_test.go +++ b/internal/app/zscaler-terraformer/cmd/generate_test.go @@ -11,32 +11,33 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/zscaler/zscaler-sdk-go/v2/zia" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/adminuserrolemgmt" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/adminuserrolemgmt/admins" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/devicegroups" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp_engines" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp_notification_templates" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp_web_rules" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlpdictionaries" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_engines" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_notification_templates" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_web_rules" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlpdictionaries" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/filteringrules" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/ipdestinationgroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/ipsourcegroups" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplications" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplicationgroups" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservicegroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservices" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/timewindow" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/locationmanagement" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/locationmanagement/locationgroups" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationgroups" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationmanagement" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/rule_labels" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/greinternalipranges" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/gretunnelinfo" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/gretunnels" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/staticips" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/virtualipaddresslist" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/virtualipaddress" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/vpncredentials" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlcategories" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlfilteringpolicies" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/user_authentication_settings" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/usermanagement/usermanagement" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/usermanagement/users" "github.com/zscaler/zscaler-sdk-go/v2/zpa" "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/appconnectorcontroller" "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/appconnectorgroup" @@ -260,16 +261,17 @@ func createClientMock(r http.RoundTripper, resourceType, zpaClientID, zpaClientS cli = &Client{ ZiaClient: ziaClient, zia: &ZIAClient{ - adminuserrolemgmt: adminuserrolemgmt.New(ziaClient), + admins: admins.New(ziaClient), filteringrules: filteringrules.New(ziaClient), ipdestinationgroups: ipdestinationgroups.New(ziaClient), ipsourcegroups: ipsourcegroups.New(ziaClient), - networkapplications: networkapplications.New(ziaClient), + networkapplicationgroups: networkapplicationgroups.New(ziaClient), + networkservicegroups: networkservicegroups.New(ziaClient), networkservices: networkservices.New(ziaClient), timewindow: timewindow.New(ziaClient), urlcategories: urlcategories.New(ziaClient), urlfilteringpolicies: urlfilteringpolicies.New(ziaClient), - virtualipaddresslist: virtualipaddresslist.New(ziaClient), + virtualipaddress: virtualipaddress.New(ziaClient), vpncredentials: vpncredentials.New(ziaClient), gretunnels: gretunnels.New(ziaClient), gretunnelinfo: gretunnelinfo.New(ziaClient), @@ -285,7 +287,7 @@ func createClientMock(r http.RoundTripper, resourceType, zpaClientID, zpaClientS rule_labels: rule_labels.New(ziaClient), security_policy_settings: security_policy_settings.New(ziaClient), user_authentication_settings: user_authentication_settings.New(ziaClient), - usermanagement: usermanagement.New(ziaClient), + users: users.New(ziaClient), }, } } diff --git a/internal/app/zscaler-terraformer/cmd/import.go b/internal/app/zscaler-terraformer/cmd/import.go index 4784106..58297a3 100644 --- a/internal/app/zscaler-terraformer/cmd/import.go +++ b/internal/app/zscaler-terraformer/cmd/import.go @@ -8,10 +8,12 @@ import ( "strconv" + "fmt" + "github.com/spf13/cobra" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlpdictionaries" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlpdictionaries" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/filteringrules" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplications" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplicationgroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservices" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlcategories" @@ -20,8 +22,6 @@ import ( "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/policysetcontroller" "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/segmentgroup" "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/servergroup" - - "fmt" ) // resourceImportStringFormats contains a mapping of the resource type to the @@ -328,7 +328,7 @@ func importResource(cmd *cobra.Command, writer io.Writer, resourceType string) { resourceCount = len(jsonPayload) _ = json.Unmarshal(m, &jsonStructData) case "zia_admin_users": - jsonPayload, err := api.zia.adminuserrolemgmt.GetAllAdminUsers() + jsonPayload, err := api.zia.admins.GetAllAdminUsers() if err != nil { log.Fatal(err) } @@ -413,7 +413,7 @@ func importResource(cmd *cobra.Command, writer io.Writer, resourceType string) { resourceCount = len(servicesFiltered) _ = json.Unmarshal(m, &jsonStructData) case "zia_firewall_filtering_network_service_groups": - jsonPayload, err := api.zia.networkservices.GetAllNetworkServiceGroups() + jsonPayload, err := api.zia.networkservicegroups.GetAllNetworkServiceGroups() if err != nil { log.Fatal(err) } @@ -421,11 +421,11 @@ func importResource(cmd *cobra.Command, writer io.Writer, resourceType string) { resourceCount = len(jsonPayload) _ = json.Unmarshal(m, &jsonStructData) case "zia_firewall_filtering_network_application_groups": - groups, err := api.zia.networkapplications.GetAllNetworkApplicationGroups() + groups, err := api.zia.networkapplicationgroups.GetAllNetworkApplicationGroups() if err != nil { log.Fatal(err) } - groupsFiltered := []networkapplications.NetworkApplicationGroups{} + groupsFiltered := []networkapplicationgroups.NetworkApplicationGroups{} for _, rule := range groups { if isInList(rule.Name, []string{"Microsoft Office365"}) { continue @@ -518,7 +518,7 @@ func importResource(cmd *cobra.Command, writer io.Writer, resourceType string) { resourceCount = len(jsonPayload) _ = json.Unmarshal(m, &jsonStructData) case "zia_user_management": - jsonPayload, err := api.zia.usermanagement.GetAllUsers() + jsonPayload, err := api.zia.users.GetAllUsers() if err != nil { log.Fatal(err) } diff --git a/internal/app/zscaler-terraformer/cmd/type.go b/internal/app/zscaler-terraformer/cmd/type.go index f020907..221dcb6 100644 --- a/internal/app/zscaler-terraformer/cmd/type.go +++ b/internal/app/zscaler-terraformer/cmd/type.go @@ -2,32 +2,33 @@ package cmd import ( "github.com/zscaler/zscaler-sdk-go/v2/zia" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/adminuserrolemgmt" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/adminuserrolemgmt/admins" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/devicegroups" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp_engines" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp_notification_templates" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp_web_rules" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlpdictionaries" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_engines" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_notification_templates" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_web_rules" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlpdictionaries" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/filteringrules" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/ipdestinationgroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/ipsourcegroups" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplications" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplicationgroups" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservicegroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservices" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/timewindow" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/locationmanagement" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/locationmanagement/locationgroups" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationgroups" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationmanagement" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/rule_labels" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/greinternalipranges" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/gretunnelinfo" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/gretunnels" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/staticips" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/virtualipaddresslist" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/virtualipaddress" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/vpncredentials" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlcategories" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlfilteringpolicies" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/user_authentication_settings" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/usermanagement/usermanagement" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/usermanagement/users" "github.com/zscaler/zscaler-sdk-go/v2/zpa" "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/appconnectorcontroller" "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/appconnectorgroup" @@ -91,21 +92,22 @@ type ZPAClient struct { } type ZIAClient struct { - adminuserrolemgmt *adminuserrolemgmt.Service + admins *admins.Service filteringrules *filteringrules.Service ipdestinationgroups *ipdestinationgroups.Service ipsourcegroups *ipsourcegroups.Service - networkapplications *networkapplications.Service + networkapplicationgroups *networkapplicationgroups.Service + networkservicegroups *networkservicegroups.Service networkservices *networkservices.Service timewindow *timewindow.Service urlcategories *urlcategories.Service urlfilteringpolicies *urlfilteringpolicies.Service - usermanagement *usermanagement.Service + users *users.Service gretunnels *gretunnels.Service gretunnelinfo *gretunnelinfo.Service greinternalipranges *greinternalipranges.Service staticips *staticips.Service - virtualipaddresslist *virtualipaddresslist.Service + virtualipaddress *virtualipaddress.Service vpncredentials *vpncredentials.Service locationmanagement *locationmanagement.Service locationgroups *locationgroups.Service diff --git a/internal/app/zscaler-terraformer/cmd/util.go b/internal/app/zscaler-terraformer/cmd/util.go index 075c846..d6cd9f4 100644 --- a/internal/app/zscaler-terraformer/cmd/util.go +++ b/internal/app/zscaler-terraformer/cmd/util.go @@ -12,32 +12,33 @@ import ( "github.com/iancoleman/strcase" "github.com/sirupsen/logrus" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/adminuserrolemgmt" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/adminuserrolemgmt/admins" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/devicegroups" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp_engines" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp_notification_templates" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp_web_rules" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlpdictionaries" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_engines" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_notification_templates" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlp_web_rules" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/dlp/dlpdictionaries" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/filteringrules" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/ipdestinationgroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/ipsourcegroups" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplications" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkapplicationgroups" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservicegroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservices" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/timewindow" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/locationmanagement" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/locationmanagement/locationgroups" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationgroups" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationmanagement" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/rule_labels" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/greinternalipranges" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/gretunnelinfo" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/gretunnels" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/staticips" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/virtualipaddresslist" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/virtualipaddress" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/vpncredentials" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlcategories" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlfilteringpolicies" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/user_authentication_settings" - "github.com/zscaler/zscaler-sdk-go/v2/zia/services/usermanagement/usermanagement" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/usermanagement/users" "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/appconnectorcontroller" "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/appconnectorgroup" "github.com/zscaler/zscaler-sdk-go/v2/zpa/services/applicationsegment" @@ -198,17 +199,18 @@ func sharedPreRun(cmd *cobra.Command, args []string) { log.Fatal("failed to initialize zscaler-sdk-go (zia)", err) } api.zia = &ZIAClient{ - adminuserrolemgmt: adminuserrolemgmt.New(ziaClient), + admins: admins.New(ziaClient), filteringrules: filteringrules.New(ziaClient), ipdestinationgroups: ipdestinationgroups.New(ziaClient), ipsourcegroups: ipsourcegroups.New(ziaClient), - networkapplications: networkapplications.New(ziaClient), + networkapplicationgroups: networkapplicationgroups.New(ziaClient), + networkservicegroups: networkservicegroups.New(ziaClient), networkservices: networkservices.New(ziaClient), timewindow: timewindow.New(ziaClient), urlcategories: urlcategories.New(ziaClient), urlfilteringpolicies: urlfilteringpolicies.New(ziaClient), - usermanagement: usermanagement.New(ziaClient), - virtualipaddresslist: virtualipaddresslist.New(ziaClient), + users: users.New(ziaClient), + virtualipaddress: virtualipaddress.New(ziaClient), vpncredentials: vpncredentials.New(ziaClient), gretunnels: gretunnels.New(ziaClient), gretunnelinfo: gretunnelinfo.New(ziaClient), diff --git a/testdata/terraform/zia/zia_admin_users/test.tf b/testdata/terraform/zia/zia_admin_users/test.tf index d0ba2d1..41cd2af 100644 --- a/testdata/terraform/zia/zia_admin_users/test.tf +++ b/testdata/terraform/zia/zia_admin_users/test.tf @@ -7,12 +7,10 @@ resource "zia_admin_users" "terraform_managed_resource" { is_service_update_comm_enabled = true login_name = "john.smith@securitygeek.io" username = "John Smith" - admin_scope { - type = "DEPARTMENT" - scope_entities { - id = [25684245] + admin_scope_type = "DEPARTMENT" + admin_scope_entities { + id = [ 25684245 ] } - } role { id = 11521 } From 73049cdc79faa2d45d6f8b76573d84011e1ffd42 Mon Sep 17 00:00:00 2001 From: William Guilherme Date: Mon, 11 Dec 2023 09:46:25 -0800 Subject: [PATCH 2/4] Fix: Fixed Pointers to new SDK v2.2.2 structure --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 991bd9a..035f28b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,7 +23,7 @@ jobs: test: strategy: matrix: - go-version: [1.19] + go-version: ['1.20'] os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: @@ -50,7 +50,7 @@ jobs: required_providers { zpa = { source = "zscaler/zpa" - version = ">= 2" + version = ">= 3" } } } From f1136f88d4bbd874751c4dfc08bd8c78630a97b3 Mon Sep 17 00:00:00 2001 From: William Guilherme Date: Mon, 11 Dec 2023 09:49:14 -0800 Subject: [PATCH 3/4] Fix: Fixed Pointers to new SDK v2.2.2 structure --- .../zpa/zpa_application_segment_inspection/test.tf | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/testdata/terraform/zpa/zpa_application_segment_inspection/test.tf b/testdata/terraform/zpa/zpa_application_segment_inspection/test.tf index 100c4de..db6e599 100644 --- a/testdata/terraform/zpa/zpa_application_segment_inspection/test.tf +++ b/testdata/terraform/zpa/zpa_application_segment_inspection/test.tf @@ -21,10 +21,13 @@ resource "zpa_application_segment_inspection" "terraform_managed_resource" { tcp_port_ranges = ["80", "80"] common_apps_dto { apps_config { - app_types = ["INSPECT"] - enabled = false - hidden = false - portal = false + name = "jenkins.example.com" + domain = "jenkins.example.com" + application_protocol = "HTTPS" + application_port = "443" + certificate_id = "21619625733130775" + enabled = true + app_types = [ "INSPECT" ] } } server_groups { From 0aa7a325429f794ee9d8ba9eb00d218540f3ef7c Mon Sep 17 00:00:00 2001 From: William Guilherme Date: Mon, 11 Dec 2023 09:57:26 -0800 Subject: [PATCH 4/4] (doc): Upddated changelog and release-notes --- CHANGELOG.md | 12 ++++++++++++ docs/guides/release-notes.md | 14 +++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 220dded..4ee616a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 0.3.4 (December, 11 2023) + +### Notes + +- Release date: **(December, 11 2023)** +- Supported Terraform version: **v1.x.x** + +### Bug Fixes + +- [PR #151](https://github.com/zscaler/zscaler-terraformer/pull/151) Fixed ZIA ``zia_admin_users`` resource schema +- [PR #151](https://github.com/zscaler/zscaler-terraformer/pull/151) Upgraded to [Zscaler-SDK-GO v2.2.2](https://github.com/zscaler/zscaler-sdk-go/releases/tag/v2.2.2) + ## 0.3.3 (October 18, 2023) ### Notes diff --git a/docs/guides/release-notes.md b/docs/guides/release-notes.md index ba87694..51cd028 100644 --- a/docs/guides/release-notes.md +++ b/docs/guides/release-notes.md @@ -12,10 +12,22 @@ Track all Zscaler Terraformer Tool releases. New resources, features, and bug fi --- -``Last updated: v0.3.3`` +``Last updated: v0.3.4`` --- +## 0.3.4 (December, 11 2023) + +### Notes + +- Release date: **(December, 11 2023)** +- Supported Terraform version: **v1.x.x** + +### Bug Fixes + +- [PR #151](https://github.com/zscaler/zscaler-terraformer/pull/151) Fixed ZIA ``zia_admin_users`` resource schema +- [PR #151](https://github.com/zscaler/zscaler-terraformer/pull/151) Upgraded to [Zscaler-SDK-GO v2.2.2](https://github.com/zscaler/zscaler-sdk-go/releases/tag/v2.2.2) + ## 0.3.3 (October 18, 2023) ### Notes