From 812328451abe0050ae8565b823fab5a206491f06 Mon Sep 17 00:00:00 2001 From: William Guilherme Date: Fri, 28 Jun 2024 09:24:31 -0700 Subject: [PATCH] fix: Fixed computed attributes in the schema (#354) * fix: Fixed computed attributes in the schema * fix: Fixed computed attributes in the schema --- go.mod | 8 +++---- go.sum | 8 +++---- zia/resource_zia_dlp_web_rules.go | 1 - zia/resource_zia_location_management.go | 1 - zia/resource_zia_url_filtering_rules.go | 31 +++++-------------------- 5 files changed, 14 insertions(+), 35 deletions(-) diff --git a/go.mod b/go.mod index 09cf6e42..9a396303 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,17 @@ module github.com/zscaler/terraform-provider-zia/v2 -go 1.21 +go 1.22 -toolchain go1.22.2 +toolchain go1.22.4 require ( github.com/biter777/countries v1.7.5 - github.com/fabiotavarespr/iso3166 v0.0.2 + github.com/fabiotavarespr/iso3166 v0.0.3 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/terraform-plugin-sdk v1.17.2 github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 - github.com/zscaler/zscaler-sdk-go/v2 v2.61.1 + github.com/zscaler/zscaler-sdk-go/v2 v2.61.3 ) require ( diff --git a/go.sum b/go.sum index fb7fea76..ad9117ae 100644 --- a/go.sum +++ b/go.sum @@ -96,8 +96,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fabiotavarespr/iso3166 v0.0.2 h1:59nauM/nQwRD0o5DCQ4mY2NkBnh+ABAaA4Cta0VmWzs= -github.com/fabiotavarespr/iso3166 v0.0.2/go.mod h1:uXl9tXoN6Ze13II7Xlzeblg+OyYRAWHIkJ5Nh3BpdKs= +github.com/fabiotavarespr/iso3166 v0.0.3 h1:Dn+D5KICqsXq0Hadqk6b6hrqqbsa7rIgKOS0jzey4bQ= +github.com/fabiotavarespr/iso3166 v0.0.3/go.mod h1:eBayeaaZOh7ql9lM+mbocWGq7DwBZyODqStq4ufhXmM= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= @@ -388,8 +388,8 @@ github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgr github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY34Wul7O/MSKey3txpPYyCqVO5ZyceuQJEI= 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.61.1 h1:NB7jbUWKvaMSjWnqjSzJLeApu20QpsRl/BnesO6u86g= -github.com/zscaler/zscaler-sdk-go/v2 v2.61.1/go.mod h1:lbdgIlORFfkAGvju4szC7SLxpLddJJKvZ6brfOECIL4= +github.com/zscaler/zscaler-sdk-go/v2 v2.61.3 h1:3kpGdzxQ4VBqmRt7yNZS13nkx2sr6Z9o4xwMFNywJ0E= +github.com/zscaler/zscaler-sdk-go/v2 v2.61.3/go.mod h1:lbdgIlORFfkAGvju4szC7SLxpLddJJKvZ6brfOECIL4= 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= diff --git a/zia/resource_zia_dlp_web_rules.go b/zia/resource_zia_dlp_web_rules.go index 5e27d498..1b22b979 100644 --- a/zia/resource_zia_dlp_web_rules.go +++ b/zia/resource_zia_dlp_web_rules.go @@ -200,7 +200,6 @@ func resourceDlpWebRules() *schema.Resource { "zscaler_incident_receiver": { Type: schema.TypeBool, Optional: true, - Default: true, Description: "Indicates whether a Zscaler Incident Receiver is associated to the DLP policy rule.", }, "locations": setIDsSchemaTypeCustom(intPtr(8), "The Name-ID pairs of locations to which the DLP policy rule must be applied."), diff --git a/zia/resource_zia_location_management.go b/zia/resource_zia_location_management.go index d7a55c8c..92b9ab45 100644 --- a/zia/resource_zia_location_management.go +++ b/zia/resource_zia_location_management.go @@ -218,7 +218,6 @@ func resourceLocationManagement() *schema.Resource { "display_time_unit": { Type: schema.TypeString, Optional: true, - Default: "MINUTE", Description: "Display Time Unit. The time unit to display for IP Surrogate idle time to disassociation.", ValidateFunc: validation.StringInSlice([]string{ "MINUTE", diff --git a/zia/resource_zia_url_filtering_rules.go b/zia/resource_zia_url_filtering_rules.go index abc307ba..d95e548b 100644 --- a/zia/resource_zia_url_filtering_rules.go +++ b/zia/resource_zia_url_filtering_rules.go @@ -217,16 +217,14 @@ func resourceURLFilteringRules() *schema.Resource { Description: "Enforce a set a validity time period for the URL Filtering rule.", }, "validity_start_time": { - Type: schema.TypeString, - Optional: true, - Description: "If enforceTimeValidity is set to true, the URL Filtering rule is valid starting on this date and time.", - ValidateFunc: validateTimesNotInPast, + Type: schema.TypeString, + Optional: true, + Description: "If enforceTimeValidity is set to true, the URL Filtering rule is valid starting on this date and time.", }, "validity_end_time": { - Type: schema.TypeString, - Optional: true, - Description: "If enforceTimeValidity is set to true, the URL Filtering rule ceases to be valid on this end date and time.", - ValidateFunc: validateTimesNotInPast, + Type: schema.TypeString, + Optional: true, + Description: "If enforceTimeValidity is set to true, the URL Filtering rule ceases to be valid on this end date and time.", }, "validity_time_zone_id": { Type: schema.TypeString, @@ -764,23 +762,6 @@ func ConvertRFC1123ToEpoch(timeStr string) (int, error) { return int(t.Unix()), nil } -func validateTimesNotInPast(val interface{}, key string) (warns []string, errs []error) { - timeStr := val.(string) - timeVal, err := ConvertRFC1123ToEpoch(timeStr) - if err != nil { - errs = append(errs, fmt.Errorf("%q: invalid time format: %v. Expected format: RFC1123 (Mon, 02 Jan 2006 15:04:05 MST)", key, err)) - return - } - - now := time.Now().Unix() - - if int64(timeVal) < now { - errs = append(errs, fmt.Errorf("%q: time cannot be in the past", key)) - } - - return -} - func convertAndValidateSizeQuota(sizeQuotaMB int) (int, error) { const ( minMB = 10