From 9695d1223befd63c497bc8af6a05304e026c081e Mon Sep 17 00:00:00 2001 From: michaelmag Date: Tue, 26 Nov 2024 15:27:17 +0100 Subject: [PATCH] fix: adjust validation for Code Engine application `scale_concurrency_target` (#5792) * fix: adjust ce app concurrency target validation * fix markup indentation --- .secrets.baseline | 8 ++++---- .../codeengine/resource_ibm_code_engine_app.go | 16 +++++++++++++--- website/docs/d/code_engine_app.html.markdown | 2 +- website/docs/r/code_engine_app.html.markdown | 1 + 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 120fc954d0..c30e5f42a1 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.mod|go.sum|.*.map|^.secrets.baseline$", "lines": null }, - "generated_at": "2024-11-07T15:32:37Z", + "generated_at": "2024-11-15T07:40:53Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -1902,7 +1902,7 @@ "hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f", "is_secret": false, "is_verified": false, - "line_number": 727, + "line_number": 737, "type": "Secret Keyword", "verified_result": null }, @@ -1910,7 +1910,7 @@ "hashed_secret": "3c956707ac29b4a200e47fceffa923341eed7e4f", "is_secret": false, "is_verified": false, - "line_number": 962, + "line_number": 972, "type": "Secret Keyword", "verified_result": null } @@ -5024,7 +5024,7 @@ } ] }, - "version": "0.13.1+ibm.62.dss", + "version": "0.13.1+ibm.61.dss", "word_list": { "file": null, "hash": null diff --git a/ibm/service/codeengine/resource_ibm_code_engine_app.go b/ibm/service/codeengine/resource_ibm_code_engine_app.go index 43bc564958..124a120d75 100644 --- a/ibm/service/codeengine/resource_ibm_code_engine_app.go +++ b/ibm/service/codeengine/resource_ibm_code_engine_app.go @@ -269,9 +269,11 @@ func ResourceIbmCodeEngineApp() *schema.Resource { Description: "Optional maximum number of requests that can be processed concurrently per instance.", }, "scale_concurrency_target": { - Type: schema.TypeInt, - Optional: true, - Description: "Optional threshold of concurrent requests per instance at which one or more additional instances are created. Use this value to scale up instances based on concurrent number of requests. This option defaults to the value of the `scale_concurrency` option, if not specified.", + Type: schema.TypeInt, + Optional: true, + Default: 100, + ValidateFunc: validate.InvokeValidator("ibm_code_engine_app", "scale_concurrency_target"), + Description: "Optional threshold of concurrent requests per instance at which one or more additional instances are created. Use this value to scale up instances based on concurrent number of requests. This option defaults to the value of the `scale_concurrency` option, if not specified.", }, "scale_cpu_limit": { Type: schema.TypeString, @@ -467,6 +469,14 @@ func ResourceIbmCodeEngineAppValidator() *validate.ResourceValidator { Regexp: `^(manager|reader|writer|none|default)$`, MinValueLength: 0, }, + validate.ValidateSchema{ + Identifier: "scale_concurrency_target", + ValidateFunctionIdentifier: validate.IntBetween, + Type: validate.TypeInt, + Optional: true, + MinValue: "1", + MaxValue: "1000", + }, validate.ValidateSchema{ Identifier: "scale_cpu_limit", ValidateFunctionIdentifier: validate.ValidateRegexpLen, diff --git a/website/docs/d/code_engine_app.html.markdown b/website/docs/d/code_engine_app.html.markdown index 9cc6639eb8..48a5fe711b 100644 --- a/website/docs/d/code_engine_app.html.markdown +++ b/website/docs/d/code_engine_app.html.markdown @@ -148,7 +148,7 @@ Nested schema for **run_volume_mounts**: * Constraints: The default value is `100`. * `scale_concurrency_target` - (Integer) Optional threshold of concurrent requests per instance at which one or more additional instances are created. Use this value to scale up instances based on concurrent number of requests. This option defaults to the value of the `scale_concurrency` option, if not specified. - + * Constraints: The default value is `100`. The maximum value is `1000`. The minimum value is `1`. * `scale_cpu_limit` - (String) Optional number of CPU set for the instance of the app. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). * Constraints: The default value is `1`. The maximum length is `10` characters. The minimum length is `0` characters. The value must match regular expression `/^([0-9.]+)([eEinumkKMGTPB]*)$/`. diff --git a/website/docs/r/code_engine_app.html.markdown b/website/docs/r/code_engine_app.html.markdown index c39b27c3f0..9db4e5958b 100644 --- a/website/docs/r/code_engine_app.html.markdown +++ b/website/docs/r/code_engine_app.html.markdown @@ -124,6 +124,7 @@ Nested schema for **run_volume_mounts**: * `scale_concurrency` - (Optional, Integer) Optional maximum number of requests that can be processed concurrently per instance. * Constraints: The default value is `100`. * `scale_concurrency_target` - (Optional, Integer) Optional threshold of concurrent requests per instance at which one or more additional instances are created. Use this value to scale up instances based on concurrent number of requests. This option defaults to the value of the `scale_concurrency` option, if not specified. + * Constraints: The default value is `100`. The maximum value is `1000`. The minimum value is `1`. * `scale_cpu_limit` - (Optional, String) Optional number of CPU set for the instance of the app. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). * Constraints: The default value is `1`. The maximum length is `10` characters. The minimum length is `0` characters. The value must match regular expression `/^([0-9.]+)([eEinumkKMGTPB]*)$/`. * `scale_down_delay` - (Optional, Integer) Optional amount of time in seconds that delays the scale-down behavior for an app instance.