Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(CIS): update response type of proxy read timeout setting #5990

Merged
merged 3 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
github.com/IBM/logs-go-sdk v0.4.0
github.com/IBM/logs-router-go-sdk v1.0.7
github.com/IBM/mqcloud-go-sdk v0.2.0
github.com/IBM/networking-go-sdk v0.51.1
github.com/IBM/networking-go-sdk v0.51.2
github.com/IBM/platform-services-go-sdk v0.73.0
github.com/IBM/project-go-sdk v0.3.5
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,12 @@ github.com/IBM/keyprotect-go-client v0.15.1 h1:m4qzqF5zOumRxKZ8s7vtK7A/UV/D278L8
github.com/IBM/keyprotect-go-client v0.15.1/go.mod h1:asXtHwL/4uCHA221Vd/7SkXEi2pcRHDzPyyksc1DthE=
github.com/IBM/logs-go-sdk v0.4.0 h1:CyUjm19EUtcJjf4mxsj6Rc7gkZDT8JEY5rLUIz8Eoag=
github.com/IBM/logs-go-sdk v0.4.0/go.mod h1:yv/GCXC4/p+MZEeXl4xjZAOMvDAVRwu61WyHZFKFXQM=
github.com/IBM/logs-router-go-sdk v1.0.5 h1:r0kC1+HfmSeQCD6zQTUp4PDI/zp4Ueo1Zo19ipHuNlw=
github.com/IBM/logs-router-go-sdk v1.0.5/go.mod h1:tCN2vFgu5xG0ob9iJcxi5M4bJ6mWmu3nhmRPnvlwev0=
github.com/IBM/logs-router-go-sdk v1.0.7 h1:uQjQAAcQdo3XvhY6MC7HakhZaXIUsGfUmKj2d5vkjnY=
github.com/IBM/logs-router-go-sdk v1.0.7/go.mod h1:tCN2vFgu5xG0ob9iJcxi5M4bJ6mWmu3nhmRPnvlwev0=
github.com/IBM/mqcloud-go-sdk v0.2.0 h1:QOWk8ZGk0QfIL0MOGTKzNdM3Qe0Hk+ifAFtNSFQo5HU=
github.com/IBM/mqcloud-go-sdk v0.2.0/go.mod h1:VZQKMtqmcdXKhmLhLiPuS/UHMs/5yo2tA/nD83cQt9E=
github.com/IBM/networking-go-sdk v0.51.1 h1:xRlDFxSMejMmJ7JPFZ9cflL86uJpbqUzuL/1D/pP7/g=
github.com/IBM/networking-go-sdk v0.51.1/go.mod h1:5aBaPKkm47LHECEOOZ4ltbwypOhapVo5aSCP3MTxmgQ=
github.com/IBM/networking-go-sdk v0.51.2 h1:aDa33IvvxMMWEB0sf+qNDWr8xE1XYoZYatG57SVsQAk=
github.com/IBM/networking-go-sdk v0.51.2/go.mod h1:5aBaPKkm47LHECEOOZ4ltbwypOhapVo5aSCP3MTxmgQ=
github.com/IBM/platform-services-go-sdk v0.73.0 h1:CKs6qCM2U549gMn4ULfJB76DaDQpit/+0VmbKDqSpFU=
github.com/IBM/platform-services-go-sdk v0.73.0/go.mod h1:LSaXGGJUGGPMCCtG1/24r9LJEbF0hmpXtQOhABRk0PY=
github.com/IBM/project-go-sdk v0.3.5 h1:L+YClFUa14foS0B/hOOY9n7sIdsT5/XQicnXOyJSpyM=
Expand Down
36 changes: 36 additions & 0 deletions ibm/service/cis/resource_ibm_cis_domain_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const (
cisDomainSettingsChallengeTTLValidatorID = "challenge_ttl"
cisDomainSettingsMaxUploadValidatorID = "max_upload"
cisDomainSettingsCipherValidatorID = "cipher"
cisDomainSettingsProxyReadTimeout = "proxy_read_timeout"
)

func ResourceIBMCISSettings() *schema.Resource {
Expand Down Expand Up @@ -369,6 +370,15 @@ func ResourceIBMCISSettings() *schema.Resource {
ibmCISDomainSettings,
cisDomainSettingsOriginPostQuantumEncryption),
},
cisDomainSettingsProxyReadTimeout: {
Type: schema.TypeInt,
Description: "Update proxy read timeout setting",
Optional: true,
Computed: true,
ValidateFunc: validate.InvokeValidator(
ibmCISDomainSettings,
cisDomainSettingsProxyReadTimeout),
},
cisDomainSettingsMinify: {
Type: schema.TypeList,
Description: "Minify setting",
Expand Down Expand Up @@ -762,6 +772,14 @@ func ResourceIBMCISDomainSettingValidator() *validate.ResourceValidator {
Type: validate.TypeString,
Required: true,
AllowedValues: quantumEncryption})
validateSchema = append(validateSchema,
validate.ValidateSchema{
Identifier: cisDomainSettingsProxyReadTimeout,
ValidateFunctionIdentifier: validate.IntBetween,
Type: validate.TypeInt,
Optional: true,
MinValue: "1",
MaxValue: "6000"})
ibmCISDomainSettingResourceValidator := validate.ResourceValidator{
ResourceName: ibmCISDomainSettings,
Schema: validateSchema}
Expand Down Expand Up @@ -802,6 +820,7 @@ var settingsList = []string{
cisDomainSettingsCipher,
cisDomainSettingsOriginMaxHTTPVersion,
cisDomainSettingsOriginPostQuantumEncryption,
cisDomainSettingsProxyReadTimeout,
}

func resourceCISSettingsUpdate(d *schema.ResourceData, meta interface{}) error {
Expand Down Expand Up @@ -1068,6 +1087,14 @@ func resourceCISSettingsUpdate(d *schema.ResourceData, meta interface{}) error {
_, resp, err = cisClient.UpdateOriginPostQuantumEncryption(opt)
}
}
case cisDomainSettingsProxyReadTimeout:
if d.HasChange(item) {
if v, ok := d.GetOk(item); ok {
opt := cisClient.NewUpdateProxyReadTimeoutOptions()
opt.SetValue(float64(v.(int)))
_, resp, err = cisClient.UpdateProxyReadTimeout(opt)
}
}
case cisDomainSettingsMinify:
if d.HasChange(item) {
if v, ok := d.GetOk(item); ok {
Expand Down Expand Up @@ -1421,6 +1448,7 @@ func resourceCISSettingsRead(d *schema.ResourceData, meta interface{}) error {
}
settingResponse = resp
settingErr = err

case cisDomainSettingsOriginPostQuantumEncryption:
opt := cisClient.NewGetOriginPostQuantumEncryptionOptions()
result, resp, err := cisClient.GetOriginPostQuantumEncryption(opt)
Expand All @@ -1430,6 +1458,14 @@ func resourceCISSettingsRead(d *schema.ResourceData, meta interface{}) error {
settingResponse = resp
settingErr = err

case cisDomainSettingsProxyReadTimeout:
opt := cisClient.NewGetProxyReadTimeoutOptions()
result, resp, err := cisClient.GetProxyReadTimeout(opt)
if err == nil {
d.Set(cisDomainSettingsProxyReadTimeout, result.Result.Value)
}
settingResponse = resp
settingErr = err
case cisDomainSettingsMinify:
opt := cisClient.NewGetMinifyOptions()
result, resp, err := cisClient.GetMinify(opt)
Expand Down
5 changes: 5 additions & 0 deletions website/docs/r/cis_domain_settings.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ resource "ibm_cis_domain_settings" "test_domain_settings" {
cipher = ["AES128-SHA256"]
origin_max_http_version = "1"
origin_post_quantum_encryption = "off"
proxy_read_timeout = 5500
minify {
css = "off"
js = "off"
Expand Down Expand Up @@ -75,6 +76,7 @@ resource "ibm_cis_domain_settings" "test" {
min_tls_version = "1.2"
origin_max_http_version = "2"
origin_post_quantum_encryption = "supported"
proxy_read_timeout = 5500
}
```

Expand Down Expand Up @@ -118,6 +120,7 @@ resource "ibm_cis_domain_settings" "test_domain_settings" {
cipher = []
origin_max_http_version = "1"
origin_post_quantum_encryption = "off"
proxy_read_timeout = 5500
minify {
css = "off"
js = "off"
Expand Down Expand Up @@ -145,6 +148,7 @@ resource "ibm_cis_domain_settings" "test" {
min_tls_version = "1.3"
origin_max_http_version = "2"
origin_post_quantum_encryption = "supported"
proxy_read_timeout = 5500
}
```

Expand Down Expand Up @@ -204,6 +208,7 @@ Review the argument references that you can specify for your resource.
- `websockets` - (Optional, String) Supported values are `off` and `on`.
- `origin_max_http_version` - (Optional, String) Sets the highest HTTP version to use with origin. Supported values are `1` and `2`.
- `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`.
- `proxy_read_timeout` - (Optional, Integer) Maximum time between two read operations from origin. Valid values are `1-6000`.

### Note

Expand Down
Loading