diff --git a/ibm_catalog.json b/ibm_catalog.json index 74113876..d4963252 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -274,9 +274,6 @@ { "key": "default_worker_pool_labels" }, - { - "key": "default_worker_pool_secondary_storage" - }, { "key": "enable_autoscaling_for_default_pool" }, diff --git a/main.tf b/main.tf index 5a7426b1..b8f71b14 100644 --- a/main.tf +++ b/main.tf @@ -43,7 +43,6 @@ locals { # Local block to verify validations for OCP AI Addon. locals { - # get the total workers per pool workers_per_pool = { for pool in var.worker_pools : @@ -56,8 +55,8 @@ locals { worker_specs = { for pool in var.worker_pools : pool.pool_name => { - cpu_count = tonumber(split("x", split(".", pool.machine_type)[1])[0]) - ram_count = tonumber(split("x", split(".", pool.machine_type)[1])[1]) + cpu_count = tonumber(regex("^.*?(\\d+)x(\\d+)", pool.machine_type)[0]) + ram_count = tonumber(regex("^.*?(\\d+)x(\\d+)", pool.machine_type)[1]) is_gpu = contains(["gx2", "gx3", "gx4"], split(".", pool.machine_type)[0]) } } diff --git a/solutions/fully-configurable/README.md b/solutions/fully-configurable/README.md index f057b4b7..0a46feb9 100644 --- a/solutions/fully-configurable/README.md +++ b/solutions/fully-configurable/README.md @@ -65,7 +65,6 @@ The following resources are provisioned by this example: | [default\_worker\_pool\_labels](#input\_default\_worker\_pool\_labels) | A set of key-value labels assigned to the worker pool for identification. For Example: { env = "prod", team = "devops" } | `map(string)` | `{}` | no | | [default\_worker\_pool\_machine\_type](#input\_default\_worker\_pool\_machine\_type) | The machine type for worker nodes.[Learn more](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-flavors) | `string` | `"bx2.8x32"` | no | | [default\_worker\_pool\_operating\_system](#input\_default\_worker\_pool\_operating\_system) | The operating system installed on the worker nodes. [Learn more](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-flavors) | `string` | `"RHEL_9_64"` | no | -| [default\_worker\_pool\_secondary\_storage](#input\_default\_worker\_pool\_secondary\_storage) | The secondary storage attached to the worker nodes. Secondary storage is immutable and can't be changed after provisioning. | `string` | `null` | no | | [default\_worker\_pool\_workers\_per\_zone](#input\_default\_worker\_pool\_workers\_per\_zone) | Number of worker nodes in each zone of the cluster. | `number` | `2` | no | | [disable\_outbound\_traffic\_protection](#input\_disable\_outbound\_traffic\_protection) | Whether to allow public outbound access from the cluster workers. This is only applicable for OCP 4.15 and later. | `bool` | `false` | no | | [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` | `true` | no | diff --git a/solutions/fully-configurable/main.tf b/solutions/fully-configurable/main.tf index 26b0ca58..059b4d75 100644 --- a/solutions/fully-configurable/main.tf +++ b/solutions/fully-configurable/main.tf @@ -157,7 +157,6 @@ locals { operating_system = var.default_worker_pool_operating_system labels = var.default_worker_pool_labels minSize = var.default_pool_minimum_number_of_nodes - secondary_storage = var.default_worker_pool_secondary_storage maxSize = var.default_pool_maximum_number_of_nodes enableAutoscaling = var.enable_autoscaling_for_default_pool boot_volume_encryption_kms_config = { diff --git a/solutions/fully-configurable/variables.tf b/solutions/fully-configurable/variables.tf index d90ee7e8..fb735e38 100644 --- a/solutions/fully-configurable/variables.tf +++ b/solutions/fully-configurable/variables.tf @@ -126,6 +126,10 @@ variable "default_worker_pool_machine_type" { type = string description = "The machine type for worker nodes.[Learn more](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-flavors)" default = "bx2.8x32" + validation { + condition = length(regexall("^[a-z0-9]+(?:\\.[a-z0-9]+)*\\.\\d+x\\d+(?:\\.[a-z0-9]+)?$", var.default_worker_pool_machine_type)) > 0 + error_message = "Invalid value provided for the machine type." + } } variable "default_worker_pool_workers_per_zone" { @@ -146,13 +150,6 @@ variable "default_worker_pool_labels" { default = {} } -variable "default_worker_pool_secondary_storage" { - type = string - description = "The secondary storage attached to the worker nodes. Secondary storage is immutable and can't be changed after provisioning." - default = null - nullable = true -} - variable "enable_autoscaling_for_default_pool" { type = bool description = "Set `true` to enable automatic scaling of worker based on workload demand." diff --git a/variables.tf b/variables.tf index 6078a42a..98bbb0d4 100644 --- a/variables.tf +++ b/variables.tf @@ -116,6 +116,15 @@ variable "worker_pools" { ]) error_message = "Invalid operating system for the given OCP version. Ensure the OS is compatible with the OCP version. Supported compatible OCP version and OS are v4.14: (REDHAT_8_64); v4.15: (REDHAT_8_64, RHCOS) ; v4.16 and v4.17: (REDHAT_8_64, RHCOS, RHEL_9_64)" } + + validation { + condition = alltrue([ + for pool in var.worker_pools : + length(regexall("^[a-z0-9]+(?:\\.[a-z0-9]+)*\\.\\d+x\\d+(?:\\.[a-z0-9]+)?$", pool.machine_type)) > 0 + ]) + error_message = "Invalid value provided for one or more machine type." + } + } variable "worker_pools_taints" {