Skip to content

Commit 949c1d6

Browse files
authored
feat: improved user experience for validating input variable values<br>* updated required terraform to be >= 1.9.0 (#587)
1 parent 4f52a84 commit 949c1d6

File tree

14 files changed

+20
-20
lines changed

14 files changed

+20
-20
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Optionally, you need the following permissions to attach Access Management tags
254254
255255
| Name | Version |
256256
|------|---------|
257-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
257+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9.0 |
258258
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.70.0, < 2.0.0 |
259259
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.16.1, < 3.0.0 |
260260
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.2.1, < 4.0.0 |
@@ -319,7 +319,7 @@ Optionally, you need the following permissions to attach Access Management tags
319319
| <a name="input_disable_public_endpoint"></a> [disable\_public\_endpoint](#input\_disable\_public\_endpoint) | Whether access to the public service endpoint is disabled when the cluster is created. Does not affect existing clusters. You can't disable a public endpoint on an existing cluster, so you can't convert a public cluster to a private cluster. To change a public endpoint to private, create another cluster with this input set to `true`. | `bool` | `false` | no |
320320
| <a name="input_enable_ocp_console"></a> [enable\_ocp\_console](#input\_enable\_ocp\_console) | Flag to specify whether to enable or disable the OpenShift console. | `bool` | `true` | no |
321321
| <a name="input_enable_registry_storage"></a> [enable\_registry\_storage](#input\_enable\_registry\_storage) | Set to `true` to enable IBM Cloud Object Storage for the Red Hat OpenShift internal image registry. Set to `false` only for new cluster deployments in an account that is allowlisted for this feature. | `bool` | `true` | no |
322-
| <a name="input_existing_cos_id"></a> [existing\_cos\_id](#input\_existing\_cos\_id) | The COS id of an already existing COS instance to use for OpenShift internal registry storage. Only required if 'enable\_registry\_storage' and 'use\_existing\_cos' are true | `string` | `null` | no |
322+
| <a name="input_existing_cos_id"></a> [existing\_cos\_id](#input\_existing\_cos\_id) | The COS id of an already existing COS instance to use for OpenShift internal registry storage. Only required if 'enable\_registry\_storage' and 'use\_existing\_cos' are true. | `string` | `null` | no |
323323
| <a name="input_force_delete_storage"></a> [force\_delete\_storage](#input\_force\_delete\_storage) | Flag indicating whether or not to delete attached storage when destroying the cluster - Default: false | `bool` | `false` | no |
324324
| <a name="input_ignore_worker_pool_size_changes"></a> [ignore\_worker\_pool\_size\_changes](#input\_ignore\_worker\_pool\_size\_changes) | Enable if using worker autoscaling. Stops Terraform managing worker count | `bool` | `false` | no |
325325
| <a name="input_import_default_worker_pool_on_create"></a> [import\_default\_worker\_pool\_on\_create](#input\_import\_default\_worker\_pool\_on\_create) | (Advanced users) Whether to handle the default worker pool as a stand-alone ibm\_container\_vpc\_worker\_pool resource on cluster creation. Only set to false if you understand the implications of managing the default worker pool as part of the cluster resource. Set to true to import the default worker pool as a separate resource. Set to false to manage the default worker pool as part of the cluster resource. | `bool` | `true` | no |

examples/add_rules_to_sg/version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33

44
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
55
# module's version.tf (basic and add_rules_to_sg), and 1 example that will always use the latest provider version (advanced, fscloud and multiple mzr).

examples/advanced/version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33

44
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
55
# module's version.tf (basic and add_rules_to_sg), and 1 example that will always use the latest provider version (advanced, fscloud and multiple mzr).

examples/basic/version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">=1.3.0"
2+
required_version = ">=1.9.0"
33

44
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
55
# module's version.tf (basic and add_rules_to_sg), and 1 example that will always use the latest provider version (advanced, fscloud and multiple mzr).

examples/cross_kms_support/version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33

44
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
55
# module's version.tf (basic and add_rules_to_sg), and 1 example that will always use the latest provider version (advanced, fscloud and multiple mzr).

examples/custom_sg/version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33

44
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
55
# module's version.tf (basic and add_rules_to_sg), and 1 example that will always use the latest provider version (advanced, fscloud and multiple mzr).

examples/fscloud/version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33

44
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
55
# module's version.tf (basic and add_rules_to_sg), and 1 example that will always use the latest provider version (advanced, fscloud and multiple mzr).

examples/multiple_mzr_clusters/version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33

44
# Ensure that there is always 1 example locked into the lowest provider version of the range defined in the main
55
# module's version.tf (basic and add_rules_to_sg), and 1 example that will always use the latest provider version (advanced, fscloud and multiple mzr).

main.tf

-6
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ locals {
2020
# if not enable_registry_storage then set cos to 'null', otherwise use existing or new CRN
2121
cos_instance_crn = var.enable_registry_storage == true ? (var.use_existing_cos != false ? var.existing_cos_id : module.cos_instance[0].cos_instance_id) : null
2222

23-
# Validation approach based on https://stackoverflow.com/a/66682419
24-
validate_condition = var.enable_registry_storage == true && var.use_existing_cos == true && var.existing_cos_id == null
25-
validate_msg = "A value for 'existing_cos_id' variable must be passed when 'use_existing_cos = true'"
26-
# tflint-ignore: terraform_unused_declarations
27-
validate_check = regex("^${local.validate_msg}$", (!local.validate_condition ? local.validate_msg : ""))
28-
2923
delete_timeout = "2h"
3024
create_timeout = "3h"
3125
update_timeout = "3h"

modules/fscloud/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module "ocp_base_fscloud" {
9292

9393
| Name | Version |
9494
|------|---------|
95-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
95+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9.0 |
9696
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.70.0, < 2.0.0 |
9797
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.16.1, < 3.0.0 |
9898
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.2.1, < 4.0.0 |

modules/fscloud/version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Terraform Version
33
##############################################################################
44
terraform {
5-
required_version = ">= 1.3.0"
5+
required_version = ">= 1.9.0"
66
required_providers {
77
# The below tflint-ignores are required because although the below providers are not directly required by this module,
88
# they are required by consuming modules, and if not set here, the top level module calling this module will not be

tests/pr_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ func TestFSCloudInSchematic(t *testing.T) {
137137

138138
// If "jp-osa" was the best region selected, default to us-south instead.
139139
// "jp-osa" is currently not allowing hs-crypto be used for encrypting in that region.
140-
if options.Region == "jp-osa" {
140+
// skipping the us-east due to provider issue : https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4843
141+
if options.Region == "jp-osa" || options.Region == "us-east" {
141142
options.Region = "us-south"
142143
}
143144

variables.tf

+6-1
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,13 @@ variable "use_existing_cos" {
245245

246246
variable "existing_cos_id" {
247247
type = string
248-
description = "The COS id of an already existing COS instance to use for OpenShift internal registry storage. Only required if 'enable_registry_storage' and 'use_existing_cos' are true"
248+
description = "The COS id of an already existing COS instance to use for OpenShift internal registry storage. Only required if 'enable_registry_storage' and 'use_existing_cos' are true."
249249
default = null
250+
251+
validation {
252+
condition = !(var.enable_registry_storage && var.use_existing_cos && var.existing_cos_id == null)
253+
error_message = "A value for 'existing_cos_id' must be provided when 'enable_registry_storage' and 'use_existing_cos' are both set to true."
254+
}
250255
}
251256

252257
variable "enable_registry_storage" {

version.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.3.0"
2+
required_version = ">= 1.9.0"
33
required_providers {
44
# Use "greater than or equal to" range in modules
55
ibm = {

0 commit comments

Comments
 (0)