diff --git a/README.md b/README.md index 87fce82..e2515bf 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ To attach access management tags to resources in this module, you need the follo | [auto\_scaling](#input\_auto\_scaling) | Optional rules to allow the database to increase resources in response to usage. Only a single autoscaling block is allowed. Make sure you understand the effects of autoscaling, especially for production environments. See https://cloud.ibm.com/docs/databases-for-mysql?topic=databases-for-mysql-autoscaling-mysql&interface=ui in the IBM Cloud Docs. |
object({
disk = object({
capacity_enabled = optional(bool, false)
free_space_less_than_percent = optional(number, 10)
io_above_percent = optional(number, 90)
io_enabled = optional(bool, false)
io_over_period = optional(string, "15m")
rate_increase_percent = optional(number, 10)
rate_limit_mb_per_member = optional(number, 3670016)
rate_period_seconds = optional(number, 900)
rate_units = optional(string, "mb")
})
memory = object({
io_above_percent = optional(number, 90)
io_enabled = optional(bool, false)
io_over_period = optional(string, "15m")
rate_increase_percent = optional(number, 10)
rate_limit_mb_per_member = optional(number, 114688)
rate_period_seconds = optional(number, 900)
rate_units = optional(string, "mb")
})
}) | `null` | no |
| [backup\_crn](#input\_backup\_crn) | The CRN of a backup resource to restore from. The backup is created by a database deployment with the same service ID. The backup is loaded after provisioning and the new deployment starts up that uses that data. A backup CRN is in the format crn:v1:<…>:backup:. If omitted, the database is provisioned empty. | `string` | `null` | no |
| [backup\_encryption\_key\_crn](#input\_backup\_encryption\_key\_crn) | The CRN of a Key Protect or Hyper Protect Crypto Services encryption key that you want to use for encrypting the disk that holds deployment backups. Applies only if `use_ibm_owned_encryption_key` is false and `use_same_kms_key_for_backups` is false. If no value is passed, and `use_same_kms_key_for_backups` is true, the value of `kms_key_crn` is used. Alternatively set `use_default_backup_encryption_key` to true to use the IBM Cloud Databases default encryption. Bare in mind that backups encryption is only available in certain regions. See [Bring your own key for backups](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok) and [Using the HPCS Key for Backup encryption](https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs#use-hpcs-backups). | `string` | `null` | no |
-| [cbr\_rules](#input\_cbr\_rules) | (Optional, list) List of CBR rules to create | list(object({
description = string
account_id = string
rule_contexts = list(object({
attributes = optional(list(object({
name = string
value = string
}))) }))
enforcement_mode = string
tags = optional(list(object({
name = string
value = string
})))
})) | `[]` | no |
+| [cbr\_rules](#input\_cbr\_rules) | The context-based restrictions rule to create. Only one rule is allowed. | list(object({
description = string
account_id = string
rule_contexts = list(object({
attributes = optional(list(object({
name = string
value = string
}))) }))
enforcement_mode = string
tags = optional(list(object({
name = string
value = string
})))
})) | `[]` | no |
| [configuration](#input\_configuration) | Database configuration parameters, see https://cloud.ibm.com/docs/databases-for-mysql?topic=databases-for-mysql-changing-configuration&interface=api for more details. | object({
default_authentication_plugin = optional(string) # sha256_password,caching_sha2_password,mysql_native_password
innodb_buffer_pool_size_percentage = optional(number) # 10 ≤ value ≤ 100
innodb_flush_log_at_trx_commit = optional(number) # 0 ≤ value ≤ 2
innodb_log_buffer_size = optional(number) # 1048576 ≤ value ≤ 4294967295
innodb_log_file_size = optional(number) # 4194304 ≤ value ≤ 274877906900
innodb_lru_scan_depth = optional(number) # 128 ≤ value ≤ 2048
innodb_read_io_threads = optional(number) # 1 ≤ value ≤ 64
innodb_write_io_threads = optional(number) # 1 ≤ value ≤ 64
max_allowed_packet = optional(number) # 1024 ≤ value ≤ 1073741824
max_connections = optional(number) # 100 ≤ value ≤ 200000
max_prepared_stmt_count = optional(number) # 0 ≤ value ≤ 4194304
mysql_max_binlog_age_sec = optional(number) # 300 ≤ value ≤ 1073741823 Default: 1800
net_read_timeout = optional(number) # 1 ≤ value ≤ 7200
net_write_timeout = optional(number) # 1 ≤ value ≤ 7200
sql_mode = optional(string) # The comma-separated list of SQL modes applied on this server globally
wait_timeout = optional(number) # 1 ≤ value ≤ 31536000
}) | `null` | no |
| [cpu\_count](#input\_cpu\_count) | Allocated dedicated CPU per member. For shared CPU, set to 0. [Learn more](https://cloud.ibm.com/docs/databases-for-mysql?topic=databases-for-mysql-resources-scaling) | `number` | `0` | no |
| [deletion\_protection](#input\_deletion\_protection) | Enable deletion protection within terraform. This is not a property of the resource and does not prevent deletion outside of terraform. The database can not be deleted by terraform when this value is set to 'true'. In order to delete with terraform the value must be set to 'false' and a terraform apply performed before the destroy is performed. The default is 'true'. | `bool` | `true` | no |
diff --git a/variables.tf b/variables.tf
index 806d530..792300d 100644
--- a/variables.tf
+++ b/variables.tf
@@ -394,9 +394,13 @@ variable "cbr_rules" {
value = string
})))
}))
- description = "(Optional, list) List of CBR rules to create"
+ description = "The context-based restrictions rule to create. Only one rule is allowed."
default = []
# Validation happens in the rule module
+ validation {
+ condition = length(var.cbr_rules) <= 1
+ error_message = "Only one CBR rule is allowed."
+ }
}
##############################################################