Skip to content

Commit b05ca46

Browse files
fix(CIS): updated domain settings (IBM-Cloud#6163)
* fix(CIS): Update domain settings * go mod changes
1 parent 07d1a55 commit b05ca46

File tree

5 files changed

+92
-8
lines changed

5 files changed

+92
-8
lines changed

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
github.com/IBM/logs-go-sdk v0.4.0
3333
github.com/IBM/logs-router-go-sdk v1.0.7
3434
github.com/IBM/mqcloud-go-sdk v0.2.0
35-
github.com/IBM/networking-go-sdk v0.51.3
35+
github.com/IBM/networking-go-sdk v0.51.4
3636
github.com/IBM/platform-services-go-sdk v0.78.0
3737
github.com/IBM/project-go-sdk v0.3.5
3838
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
@@ -207,6 +207,7 @@ require (
207207
go.opentelemetry.io/otel/metric v1.28.0 // indirect
208208
go.opentelemetry.io/otel/trace v1.28.0 // indirect
209209
go.uber.org/atomic v1.9.0 // indirect
210+
go.uber.org/automaxprocs v1.6.0 // indirect
210211
go.uber.org/ratelimit v0.2.0 // indirect
211212
go.uber.org/zap v1.27.0 // indirect
212213
golang.org/x/mod v0.21.0 // indirect

go.sum

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ github.com/IBM/logs-router-go-sdk v1.0.7 h1:uQjQAAcQdo3XvhY6MC7HakhZaXIUsGfUmKj2
154154
github.com/IBM/logs-router-go-sdk v1.0.7/go.mod h1:tCN2vFgu5xG0ob9iJcxi5M4bJ6mWmu3nhmRPnvlwev0=
155155
github.com/IBM/mqcloud-go-sdk v0.2.0 h1:QOWk8ZGk0QfIL0MOGTKzNdM3Qe0Hk+ifAFtNSFQo5HU=
156156
github.com/IBM/mqcloud-go-sdk v0.2.0/go.mod h1:VZQKMtqmcdXKhmLhLiPuS/UHMs/5yo2tA/nD83cQt9E=
157-
github.com/IBM/networking-go-sdk v0.51.3 h1:GW2VLP7XVcAHin6eWnCNA9l3gsv5tnyjf5UgGwMA7hk=
158-
github.com/IBM/networking-go-sdk v0.51.3/go.mod h1:T27XI2gtPjT7tW9nkHgrpBUNbmAc9OR41Z78Y493PoA=
157+
github.com/IBM/networking-go-sdk v0.51.4 h1:rkbR+gUkksLKjNYL5YEWEAMv3qddR0mUkxObDMa4l/s=
158+
github.com/IBM/networking-go-sdk v0.51.4/go.mod h1:gjCFEp+UVP7FUlcq2C1RaoZAXFcD39CQdlUk7uVKko4=
159159
github.com/IBM/platform-services-go-sdk v0.78.0 h1:OqfO8Qd4HQJcpgP/CLnjqFPgXtXLPbPxXlRzX4SQUH0=
160160
github.com/IBM/platform-services-go-sdk v0.78.0/go.mod h1:sX7rPXMNqmAt6wQyjnF+oISRFwz6I6XNX9My/mzLqp4=
161161
github.com/IBM/project-go-sdk v0.3.5 h1:L+YClFUa14foS0B/hOOY9n7sIdsT5/XQicnXOyJSpyM=
@@ -1013,8 +1013,8 @@ github.com/onsi/ginkgo/v2 v2.9.7/go.mod h1:cxrmXWykAwTwhQsJOPfdIDiJ+l2RYq7U8hFU+
10131013
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
10141014
github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
10151015
github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM=
1016-
github.com/onsi/ginkgo/v2 v2.23.0 h1:FA1xjp8ieYDzlgS5ABTpdUDB7wtngggONc8a7ku2NqQ=
1017-
github.com/onsi/ginkgo/v2 v2.23.0/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM=
1016+
github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus=
1017+
github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8=
10181018
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
10191019
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
10201020
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
@@ -1046,8 +1046,8 @@ github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJK
10461046
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
10471047
github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
10481048
github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0=
1049-
github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU=
1050-
github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
1049+
github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y=
1050+
github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
10511051
github.com/openshift/api v0.0.0-20210105115604-44119421ec6b/go.mod h1:aqU5Cq+kqKKPbDMqxo9FojgDeSpNJI7iuskjXjtojDg=
10521052
github.com/openshift/api v0.0.0-20240301093301-ce10821dc999 h1:+S998xHiJApsJZjRAO8wyedU9GfqFd8mtwWly6LqHDo=
10531053
github.com/openshift/api v0.0.0-20240301093301-ce10821dc999/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
@@ -1298,6 +1298,8 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
12981298
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
12991299
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
13001300
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
1301+
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
1302+
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
13011303
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
13021304
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
13031305
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=

ibm/service/cis/resource_ibm_cis_domain_settings.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ const (
7272
cisDomainSettingsMaxUploadValidatorID = "max_upload"
7373
cisDomainSettingsCipherValidatorID = "cipher"
7474
cisDomainSettingsProxyReadTimeout = "proxy_read_timeout"
75+
cisDomainSettingsOpportunisticOnion = "opportunistic_onion"
76+
cisDomainSettingsLogRetention = "log_retention"
7577
)
7678

7779
func ResourceIBMCISSettings() *schema.Resource {
@@ -484,6 +486,21 @@ func ResourceIBMCISSettings() *schema.Resource {
484486
},
485487
},
486488
},
489+
cisDomainSettingsOpportunisticOnion: {
490+
Type: schema.TypeString,
491+
Description: "Opportunistic onion setting",
492+
Optional: true,
493+
Computed: true,
494+
ValidateFunc: validate.InvokeValidator(
495+
ibmCISDomainSettings,
496+
cisDomainSettingsOpportunisticOnion),
497+
},
498+
cisDomainSettingsLogRetention: {
499+
Type: schema.TypeBool,
500+
Description: "Log Retention setting",
501+
Optional: true,
502+
Computed: true,
503+
},
487504
},
488505

489506
Create: resourceCISSettingsUpdate,
@@ -780,6 +797,13 @@ func ResourceIBMCISDomainSettingValidator() *validate.ResourceValidator {
780797
Optional: true,
781798
MinValue: "1",
782799
MaxValue: "6000"})
800+
validateSchema = append(validateSchema,
801+
validate.ValidateSchema{
802+
Identifier: cisDomainSettingsOpportunisticOnion,
803+
ValidateFunctionIdentifier: validate.ValidateAllowedStringValue,
804+
Type: validate.TypeString,
805+
Optional: true,
806+
AllowedValues: "on, off"})
783807
ibmCISDomainSettingResourceValidator := validate.ResourceValidator{
784808
ResourceName: ibmCISDomainSettings,
785809
Schema: validateSchema}
@@ -821,6 +845,8 @@ var settingsList = []string{
821845
cisDomainSettingsOriginMaxHTTPVersion,
822846
cisDomainSettingsOriginPostQuantumEncryption,
823847
cisDomainSettingsProxyReadTimeout,
848+
cisDomainSettingsOpportunisticOnion,
849+
cisDomainSettingsLogRetention,
824850
}
825851

826852
func resourceCISSettingsUpdate(d *schema.ResourceData, meta interface{}) error {
@@ -1155,6 +1181,22 @@ func resourceCISSettingsUpdate(d *schema.ResourceData, meta interface{}) error {
11551181
_, resp, err = cisClient.UpdateMobileRedirect(opt)
11561182
}
11571183
}
1184+
case cisDomainSettingsOpportunisticOnion:
1185+
if d.HasChange(item) {
1186+
if v, ok := d.GetOk(item); ok {
1187+
opt := cisClient.NewUpdateOpportunisticOnionOptions()
1188+
opt.SetValue(v.(string))
1189+
_, resp, err = cisClient.UpdateOpportunisticOnion(opt)
1190+
}
1191+
}
1192+
case cisDomainSettingsLogRetention:
1193+
if d.HasChange(item) {
1194+
if v, ok := d.GetOk(item); ok {
1195+
opt := cisClient.NewUpdateLogRetentionOptions(*cisClient.Crn, *cisClient.ZoneIdentifier)
1196+
opt.SetFlag(v.(bool))
1197+
_, resp, err = cisClient.UpdateLogRetention(opt)
1198+
}
1199+
}
11581200
}
11591201
if err != nil {
11601202
if resp != nil && resp.StatusCode == 405 {
@@ -1534,6 +1576,23 @@ func resourceCISSettingsRead(d *schema.ResourceData, meta interface{}) error {
15341576
}
15351577
settingResponse = resp
15361578
settingErr = err
1579+
1580+
case cisDomainSettingsOpportunisticOnion:
1581+
opt := cisClient.NewGetOpportunisticOnionOptions()
1582+
result, resp, err := cisClient.GetOpportunisticOnion(opt)
1583+
if err == nil {
1584+
d.Set(cisDomainSettingsOpportunisticOnion, result.Result.Value)
1585+
}
1586+
settingResponse = resp
1587+
settingErr = err
1588+
case cisDomainSettingsLogRetention:
1589+
opt := cisClient.NewGetLogRetentionOptions(*cisClient.Crn, *cisClient.ZoneIdentifier)
1590+
result, resp, err := cisClient.GetLogRetention(opt)
1591+
if err == nil {
1592+
d.Set(cisDomainSettingsLogRetention, result.Result.Flag)
1593+
}
1594+
settingResponse = resp
1595+
settingErr = err
15371596
}
15381597

15391598
if settingErr != nil {

metadata/provider_metadata.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94240,6 +94240,22 @@
9424094240
"options": "on, off",
9424194241
"optional": true,
9424294242
"computed": true
94243+
},
94244+
{
94245+
"name": "opportunistic_onion",
94246+
"type": "TypeString",
94247+
"description": "opportunistic_onion setting",
94248+
"options": "on, off",
94249+
"optional": true,
94250+
"computed": true
94251+
},
94252+
{
94253+
"name": "log_retention",
94254+
"type": "TypeBool",
94255+
"description": "log_retention setting",
94256+
"options": "true, false",
94257+
"optional": true,
94258+
"computed": true
9424394259
}
9424494260
],
9424594261
"ibm_cis_edge_functions_action": [
@@ -152774,4 +152790,4 @@
152774152790
]
152775152791
},
152776152792
"Version": "1.59.0"
152777-
}
152793+
}

website/docs/r/cis_domain_settings.html.markdown

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ resource "ibm_cis_domain_settings" "test_domain_settings" {
4343
tls_client_auth = "off"
4444
true_client_ip_header = "off"
4545
websockets = "off"
46+
opportunistic_onion = "off"
47+
log_retention = false
4648
challenge_ttl = 31536000
4749
max_upload = 300
4850
cipher = ["AES128-SHA256"]
@@ -115,6 +117,8 @@ resource "ibm_cis_domain_settings" "test_domain_settings" {
115117
tls_client_auth = "off"
116118
true_client_ip_header = "off"
117119
websockets = "off"
120+
opportunistic_onion = "off"
121+
log_retention = false
118122
challenge_ttl = 31536000
119123
max_upload = 300
120124
cipher = []
@@ -209,6 +213,8 @@ Review the argument references that you can specify for your resource.
209213
- `origin_max_http_version` - (Optional, String) Sets the highest HTTP version to use with origin. Supported values are `1` and `2`.
210214
- `origin_post_quantum_encryption` - (Optional, String) Wheather to use post-quantum key agreement algorithms when connecting to the origin. Supported values are `off`, `preferred` and `supported`.
211215
- `proxy_read_timeout` - (Optional, Integer) Maximum time between two read operations from origin. Valid values are `1-6000`.
216+
- `opportunistic_onion` - (Optional, String) Supported values are `off` and `on`.
217+
- `log_retention` - (Optional, String) Supported values are `false` and `true`.
212218

213219
### Note
214220

0 commit comments

Comments
 (0)