Skip to content

Commit 960eb62

Browse files
authored
fix: Fixed resources with custom IDs (#393)
* fix: Fixed resources with custom IDs.
1 parent 0a9ad65 commit 960eb62

12 files changed

+48
-28
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 4.0.5 (February, 10 2025)
4+
5+
### Notes
6+
7+
- Release date: **(February, 10 2025)**
8+
- Supported Terraform version: **v1.x**
9+
10+
### Bug Fixes
11+
12+
- [PR #393](https://github.com/zscaler/terraform-provider-zia/pull/393) - Fixed the custom ID for the following resources:
13+
- `zia_auth_settings_urls`
14+
- `zia_sandbox_behavioral_analysis`
15+
- `zia_security_settings`
16+
317
## 4.0.4 (February, 6 2025)
418

519
### Notes

GNUmakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ test\:integration\:zscalertwo:
196196
build13: GOOS=$(shell go env GOOS)
197197
build13: GOARCH=$(shell go env GOARCH)
198198
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
199-
build13: DESTINATION=$(APPDATA)/terraform.d/plugins/$(ZIA_PROVIDER_NAMESPACE)/4.0.4/$(GOOS)_$(GOARCH)
199+
build13: DESTINATION=$(APPDATA)/terraform.d/plugins/$(ZIA_PROVIDER_NAMESPACE)/4.0.5/$(GOOS)_$(GOARCH)
200200
else
201-
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(ZIA_PROVIDER_NAMESPACE)/4.0.4/$(GOOS)_$(GOARCH)
201+
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(ZIA_PROVIDER_NAMESPACE)/4.0.5/$(GOOS)_$(GOARCH)
202202
endif
203203
build13: fmtcheck
204204
@echo "==> Installing plugin to $(DESTINATION)"
205205
@mkdir -p $(DESTINATION)
206-
go build -o $(DESTINATION)/terraform-provider-zia_v4.0.4
206+
go build -o $(DESTINATION)/terraform-provider-zia_v4.0.5
207207

208208
coverage: test
209209
@echo "✓ Opening coverage for unit tests ..."

docs/guides/release-notes.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,24 @@ description: |-
1212
Track all ZIA Terraform provider's releases. New resources, features, and bug fixes will be tracked here.
1313

1414
---
15-
``Last updated: v4.0.4``
15+
``Last updated: v4.0.5``
1616

1717
---
1818

19+
## 4.0.5 (February, 10 2025)
20+
21+
### Notes
22+
23+
- Release date: **(February, 10 2025)**
24+
- Supported Terraform version: **v1.x**
25+
26+
### Bug Fixes
27+
28+
- [PR #393](https://github.com/zscaler/terraform-provider-zia/pull/393) - Fixed the custom ID for the following resources:
29+
- `zia_auth_settings_urls`
30+
- `zia_sandbox_behavioral_analysis`
31+
- `zia_security_settings`
32+
1933
## 4.0.4 (February, 6 2025)
2034

2135
### Notes

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/hashicorp/go-hclog v1.6.3
1010
github.com/hashicorp/terraform-plugin-sdk v1.17.2
1111
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0
12-
github.com/zscaler/zscaler-sdk-go/v3 v3.1.3
12+
github.com/zscaler/zscaler-sdk-go/v3 v3.1.4
1313
)
1414

1515
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRK
401401
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
402402
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
403403
github.com/zclconf/go-cty-yaml v1.0.2/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0=
404-
github.com/zscaler/zscaler-sdk-go/v3 v3.1.3 h1:TIR6dLxAb0QZPj7efrKjwlgNCsYvj3Zy7EDKMo0u70s=
405-
github.com/zscaler/zscaler-sdk-go/v3 v3.1.3/go.mod h1:2gXo+LVFYtr+/oCe+mETsXlb9sJEzRtPl6JwPhSIgWM=
404+
github.com/zscaler/zscaler-sdk-go/v3 v3.1.4 h1:1rQ3BzfsBeqczpVkdi2aQTAefhft5iUs85J+u/naaME=
405+
github.com/zscaler/zscaler-sdk-go/v3 v3.1.4/go.mod h1:2gXo+LVFYtr+/oCe+mETsXlb9sJEzRtPl6JwPhSIgWM=
406406
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
407407
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
408408
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=

zia/config.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,6 @@ func NewConfig(d *schema.ResourceData) *Config {
173173
config.sandboxCloud = os.Getenv("ZSCALER_SANDBOX_CLOUD")
174174
}
175175

176-
if val, ok := d.GetOk("cloud"); ok {
177-
config.cloud = val.(string)
178-
}
179-
if config.cloud == "" && os.Getenv("ZSCALER_CLOUD") != "" {
180-
config.cloud = os.Getenv("ZSCALER_CLOUD")
181-
}
182-
183176
if val, ok := d.GetOk("max_retries"); ok {
184177
config.retryCount = val.(int)
185178
}

zia/provider_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ func TestProviderValidate(t *testing.T) {
143143
cloud string // Optional field
144144
expectError bool
145145
}{
146-
{"valid client_id + client_secret", "clientID", "clientSecret", "vanityDomain", "cloud", false},
147-
{"missing client_id", "", "clientSecret", "vanityDomain", "cloud", true},
148-
{"missing clientSecret", "clientID", "", "vanityDomain", "cloud", true},
149-
{"missing vanity domain", "clientID", "clientSecret", "", "cloud", true},
150-
{"valid client_id + client_secret without cloud", "clientID", "clientSecret", "vanityDomain", "", false}, // Ensures cloud is optional
146+
{"valid client_id + client_secret", "clientID", "clientSecret", "vanityDomain", "zscaler_cloud", false},
147+
{"missing client_id", "", "clientSecret", "vanityDomain", "zscaler_cloud", true},
148+
{"missing clientSecret", "clientID", "", "vanityDomain", "zscaler_cloud", true},
149+
{"missing vanity domain", "clientID", "clientSecret", "", "zscaler_cloud", true},
150+
{"valid client_id + client_secret without zscaler_cloud", "clientID", "clientSecret", "vanityDomain", "", false}, // Ensures cloud is optional
151151
}
152152

153153
// Execute each test case
@@ -162,7 +162,7 @@ func TestProviderValidate(t *testing.T) {
162162
resourceConfig["client_secret"] = test.clientSecret
163163
}
164164
if test.cloud != "" {
165-
resourceConfig["cloud"] = test.cloud
165+
resourceConfig["zscaler_cloud"] = test.cloud
166166
}
167167

168168
config := terraform.NewResourceConfigRaw(resourceConfig)

zia/resource_zia_auth_settings_urls.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func resourceAuthSettingsUrlsRead(ctx context.Context, d *schema.ResourceData, m
5858
if err != nil {
5959
return diag.FromErr(err)
6060
}
61-
d.SetId("exempted_urls")
61+
d.SetId("all_urls")
6262
_ = d.Set("urls", res.URLs)
6363
return nil
6464
}
@@ -82,7 +82,7 @@ func resourceAuthSettingsUrlsCreate(ctx context.Context, d *schema.ResourceData,
8282
if err != nil {
8383
return diag.FromErr(err)
8484
}
85-
d.SetId("exempted_urls")
85+
d.SetId("all_urls")
8686
// Sleep for 2 seconds before potentially triggering the activation
8787
time.Sleep(2 * time.Second)
8888

zia/resource_zia_sandbox_behavioral_analysis_advanced_settings.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func resourceSandboxSettingsCreate(ctx context.Context, d *schema.ResourceData,
9696
if err != nil {
9797
return diag.FromErr(err)
9898
}
99-
d.SetId("hash_list")
99+
d.SetId("sandbox_settings")
100100
// Sleep for 2 seconds before potentially triggering the activation
101101
time.Sleep(2 * time.Second)
102102

@@ -121,7 +121,7 @@ func resourceSandboxSettingsRead(ctx context.Context, d *schema.ResourceData, me
121121
}
122122

123123
if resp != nil {
124-
d.SetId("hash_list")
124+
d.SetId("sandbox_settings")
125125
sortedHashes := sortStringSlice(resp.FileHashesToBeBlocked)
126126
err := d.Set("file_hashes_to_be_blocked", sortedHashes)
127127
if err != nil {

zia/resource_zia_security_policy_settings.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func resourceSecurityPolicySettingsCreate(ctx context.Context, d *schema.Resourc
8787
if err != nil {
8888
return diag.FromErr(err)
8989
}
90-
d.SetId("url_list")
90+
d.SetId("all_urls")
9191

9292
// Sleep for 2 seconds before potentially triggering the activation
9393
time.Sleep(2 * time.Second)
@@ -143,7 +143,7 @@ func resourceSecurityPolicySettingsRead(ctx context.Context, d *schema.ResourceD
143143
}
144144

145145
if resp != nil {
146-
d.SetId("url_id")
146+
d.SetId("all_urls")
147147
_ = d.Set("whitelist_urls", resp.White)
148148
_ = d.Set("blacklist_urls", resp.Black)
149149

0 commit comments

Comments
 (0)