Skip to content

Commit de436c1

Browse files
authored
fix: added validation to CBR input (#842)
1 parent 9e70959 commit de436c1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ Optionally, you need the following permissions to attach Access Management tags
338338
| <a name="input_addons"></a> [addons](#input\_addons) | Map of OCP cluster add-on versions to install (NOTE: The 'vpc-block-csi-driver' add-on is installed by default for VPC clusters and 'ibm-storage-operator' is installed by default in OCP 4.15 and later, however you can explicitly specify it here if you wish to choose a later version than the default one). For full list of all supported add-ons and versions, see https://cloud.ibm.com/docs/containers?topic=containers-supported-cluster-addon-versions | <pre>object({<br/> debug-tool = optional(object({<br/> version = optional(string)<br/> parameters_json = optional(string)<br/> }))<br/> image-key-synchronizer = optional(object({<br/> version = optional(string)<br/> parameters_json = optional(string)<br/> }))<br/> openshift-data-foundation = optional(object({<br/> version = optional(string)<br/> parameters_json = optional(string)<br/> }))<br/> vpc-file-csi-driver = optional(object({<br/> version = optional(string)<br/> parameters_json = optional(string)<br/> }))<br/> static-route = optional(object({<br/> version = optional(string)<br/> parameters_json = optional(string)<br/> }))<br/> cluster-autoscaler = optional(object({<br/> version = optional(string)<br/> parameters_json = optional(string)<br/> }))<br/> vpc-block-csi-driver = optional(object({<br/> version = optional(string)<br/> parameters_json = optional(string)<br/> }))<br/> ibm-storage-operator = optional(object({<br/> version = optional(string)<br/> parameters_json = optional(string)<br/> }))<br/> openshift-ai = optional(object({<br/> version = optional(string)<br/> parameters_json = optional(string)<br/> }))<br/> })</pre> | `{}` | no |
339339
| <a name="input_allow_default_worker_pool_replacement"></a> [allow\_default\_worker\_pool\_replacement](#input\_allow\_default\_worker\_pool\_replacement) | (Advanced users) Set to true to allow the module to recreate a default worker pool. If you wish to make any change to the default worker pool which requires the re-creation of the default pool follow these [steps](https://github.com/terraform-ibm-modules/terraform-ibm-base-ocp-vpc?tab=readme-ov-file#important-considerations-for-terraform-and-default-worker-pool). | `bool` | `false` | no |
340340
| <a name="input_attach_ibm_managed_security_group"></a> [attach\_ibm\_managed\_security\_group](#input\_attach\_ibm\_managed\_security\_group) | Specify whether to attach the IBM-defined default security group (whose name is kube-<clusterid>) to all worker nodes. Only applicable if `custom_security_group_ids` is set. | `bool` | `true` | no |
341-
| <a name="input_cbr_rules"></a> [cbr\_rules](#input\_cbr\_rules) | The list of context-based restriction rules to create. | <pre>list(object({<br/> description = string<br/> account_id = string<br/> rule_contexts = list(object({<br/> attributes = optional(list(object({<br/> name = string<br/> value = string<br/> }))) }))<br/> enforcement_mode = string<br/> tags = optional(list(object({<br/> name = string<br/> value = string<br/> })), [])<br/> operations = optional(list(object({<br/> api_types = list(object({<br/> api_type_id = string<br/> }))<br/> })))<br/> }))</pre> | `[]` | no |
341+
| <a name="input_cbr_rules"></a> [cbr\_rules](#input\_cbr\_rules) | The context-based restrictions rule to create. Only one rule is allowed. | <pre>list(object({<br/> description = string<br/> account_id = string<br/> rule_contexts = list(object({<br/> attributes = optional(list(object({<br/> name = string<br/> value = string<br/> }))) }))<br/> enforcement_mode = string<br/> tags = optional(list(object({<br/> name = string<br/> value = string<br/> })), [])<br/> operations = optional(list(object({<br/> api_types = list(object({<br/> api_type_id = string<br/> }))<br/> })))<br/> }))</pre> | `[]` | no |
342342
| <a name="input_cluster_config_endpoint_type"></a> [cluster\_config\_endpoint\_type](#input\_cluster\_config\_endpoint\_type) | Specify which type of endpoint to use for cluster config access: 'default', 'private', 'vpe', 'link'. A 'default' value uses the default endpoint of the cluster. | `string` | `"default"` | no |
343343
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | The name that is assigned to the provisioned cluster. | `string` | n/a | yes |
344344
| <a name="input_cluster_ready_when"></a> [cluster\_ready\_when](#input\_cluster\_ready\_when) | The cluster is ready based on one of the following:: MasterNodeReady (not recommended), OneWorkerNodeReady, Normal, IngressReady | `string` | `"IngressReady"` | no |

variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,12 @@ variable "cbr_rules" {
430430
}))
431431
})))
432432
}))
433-
description = "The list of context-based restriction rules to create."
433+
description = "The context-based restrictions rule to create. Only one rule is allowed."
434434
default = []
435+
validation {
436+
condition = length(var.cbr_rules) <= 1
437+
error_message = "Only one CBR rule is allowed."
438+
}
435439
}
436440

437441
##############################################################

0 commit comments

Comments
 (0)