Skip to content

Commit

Permalink
fix: Fixed computed attributes in the schema (#354)
Browse files Browse the repository at this point in the history
* fix: Fixed computed attributes in the schema

* fix: Fixed computed attributes in the schema
  • Loading branch information
willguibr authored Jun 28, 2024
1 parent 9e85f76 commit 8123284
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 35 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
1 change: 0 additions & 1 deletion zia/resource_zia_dlp_web_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."),
Expand Down
1 change: 0 additions & 1 deletion zia/resource_zia_location_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
31 changes: 6 additions & 25 deletions zia/resource_zia_url_filtering_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8123284

Please sign in to comment.