diff --git a/README.md b/README.md index 59bc324..ccba1c1 100644 --- a/README.md +++ b/README.md @@ -108,23 +108,23 @@ To attach access management tags to resources in this module, you need the follo | [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
}))
| `[]` | no | | [configuration](#input\_configuration) | Database configuration. [Learn more](https://cloud.ibm.com/apidocs/cloud-databases-api/cloud-databases-api-v4#setdatabaseconfiguration-request) |
object({
max_connections = optional(number)
max_prepared_transactions = optional(number)
deadlock_timeout = optional(number)
effective_io_concurrency = optional(number)
max_replication_slots = optional(number)
max_wal_senders = optional(number)
shared_buffers = optional(number)
synchronous_commit = optional(string)
wal_level = optional(string)
archive_timeout = optional(number)
log_min_duration_statement = optional(number)
})
| `null` | no | +| [cpu\_count](#input\_cpu\_count) | Allocated dedicated CPU per member. Minimum number of CPU allowed is 3. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `3` | no | +| [disk\_mb](#input\_disk\_mb) | Allocated disk per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `20480` | no | | [edb\_version](#input\_edb\_version) | Version of the Enterprise DB instance to provision. If no value is passed, the current preferred version of IBM Cloud Databases is used. For our version policy, see https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-versioning-policy for more details | `string` | `null` | no | | [kms\_key\_crn](#input\_kms\_key\_crn) | The CRN of a Key Protect or Hyper Protect Crypto Services encryption key to encrypt your data. Applies only if `use_ibm_owned_encryption_key` is false. By default this key is used for both deployment data and backups, but this behaviour can be altered using the `use_same_kms_key_for_backups` and `backup_encryption_key_crn` inputs. 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 | -| [member\_cpu\_count](#input\_member\_cpu\_count) | Allocated dedicated CPU per member. Minimum number of CPU allowed is 3. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `3` | no | -| [member\_disk\_mb](#input\_member\_disk\_mb) | Allocated disk per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `20480` | no | | [member\_host\_flavor](#input\_member\_host\_flavor) | Allocated host flavor per member. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/database#host_flavor). | `string` | `null` | no | -| [member\_memory\_mb](#input\_member\_memory\_mb) | Allocated memory per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `4096` | no | | [members](#input\_members) | Allocated number of members. Members can be scaled up but not down. | `number` | `3` | no | +| [memory\_mb](#input\_memory\_mb) | Allocated memory per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `4096` | no | | [name](#input\_name) | The name given to the Enterprise DB instance. | `string` | n/a | yes | | [pitr\_id](#input\_pitr\_id) | (Optional) The ID of the source deployment EDB instance that you want to recover back to. The EDB instance is expected to be in an up and in running state. | `string` | `null` | no | | [pitr\_time](#input\_pitr\_time) | (Optional) The timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) that you want to restore to. To retrieve the timestamp, run the command (ibmcloud cdb postgresql earliest-pitr-timestamp ). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-pitr | `string` | `null` | no | | [region](#input\_region) | The region where you want to deploy your instance. | `string` | `"us-south"` | no | | [remote\_leader\_crn](#input\_remote\_leader\_crn) | A CRN of the leader database to make the replica(read-only) deployment. The leader database is created by a database deployment with the same service ID. A read-only replica is set up to replicate all of your data from the leader deployment to the replica deployment by using asynchronous replication. For more information, see https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-read-only-replicas | `string` | `null` | no | | [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where Enterprise DB instance will be created. | `string` | n/a | yes | -| [resource\_tags](#input\_resource\_tags) | Optional list of tags to be added to the Enterprise DB instance. | `list(string)` | `[]` | no | | [service\_credential\_names](#input\_service\_credential\_names) | Map of name, role for service credentials that you want to create for the database | `map(string)` | `{}` | no | | [service\_endpoints](#input\_service\_endpoints) | Specify whether you want to enable the public, private, or both service endpoints. Supported values are 'public', 'private', or 'public-and-private'. | `string` | `"private"` | no | | [skip\_iam\_authorization\_policy](#input\_skip\_iam\_authorization\_policy) | Set to true to skip the creation of IAM authorization policies that permits all Databases for EnterpriseDB instances in the given resource group 'Reader' access to the Key Protect or Hyper Protect Crypto Services key that was provided in the `kms_key_crn` and `backup_encryption_key_crn` inputs. This policy is required in order to enable KMS encryption, so only skip creation if there is one already present in your account. No policy is created if `use_ibm_owned_encryption_key` is true. | `bool` | `false` | no | +| [tags](#input\_tags) | Optional list of tags to be added to the Enterprise DB instance. | `list(string)` | `[]` | no | | [use\_default\_backup\_encryption\_key](#input\_use\_default\_backup\_encryption\_key) | When `use_ibm_owned_encryption_key` is set to false, backups will be encrypted with either the key specified in `kms_key_crn`, or in `backup_encryption_key_crn` if a value is passed. If you do not want to use your own key for backups encryption, you can set this to `true` to use the IBM Cloud Databases default encryption for backups. Alternatively set `use_ibm_owned_encryption_key` to true to use the default encryption for both backups and deployment data. | `bool` | `false` | no | | [use\_ibm\_owned\_encryption\_key](#input\_use\_ibm\_owned\_encryption\_key) | IBM Cloud Databases will secure your deployment's data at rest automatically with an encryption key that IBM hold. Alternatively, you may select your own Key Management System instance and encryption key (Key Protect or Hyper Protect Crypto Services) by setting this to false. If setting to false, a value must be passed for the `kms_key_crn` input. | `bool` | `true` | no | | [use\_same\_kms\_key\_for\_backups](#input\_use\_same\_kms\_key\_for\_backups) | Set this to false if you wan't to use a different key that you own to encrypt backups. When set to false, a value is required for the `backup_encryption_key_crn` input. Alternatiely set `use_default_backup_encryption_key` to true to use the IBM Cloud Databases default encryption. Applies only if `use_ibm_owned_encryption_key` is false. 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). | `bool` | `true` | no | diff --git a/examples/backup/main.tf b/examples/backup/main.tf index 365ac2f..e254e30 100644 --- a/examples/backup/main.tf +++ b/examples/backup/main.tf @@ -10,32 +10,18 @@ module "resource_group" { existing_resource_group_name = var.resource_group } -module "enterprise_db" { - count = var.enterprise_db_backup_crn != null ? 0 : 1 - source = "../.." - resource_group_id = module.resource_group.resource_group_id - name = "${var.prefix}-edb" - edb_version = var.edb_version - region = var.region - resource_tags = var.resource_tags - access_tags = var.access_tags - member_host_flavor = "b3c.4x16.encrypted" -} - data "ibm_database_backups" "backup_database" { - count = var.enterprise_db_backup_crn != null ? 0 : 1 - deployment_id = module.enterprise_db[0].id + deployment_id = var.existing_database_crn } - # New enterprise db instance pointing to the backup instance -module "restored_enterprise_db" { +module "restored_icd_enterprise_db" { source = "../.." resource_group_id = module.resource_group.resource_group_id name = "${var.prefix}-edb-restored" edb_version = var.edb_version region = var.region - resource_tags = var.resource_tags + tags = var.resource_tags access_tags = var.access_tags member_host_flavor = "b3c.4x16.encrypted" - backup_crn = var.enterprise_db_backup_crn == null ? data.ibm_database_backups.backup_database[0].backups[0].backup_id : var.enterprise_db_backup_crn + backup_crn = data.ibm_database_backups.backup_database.backups[0].backup_id } diff --git a/examples/backup/outputs.tf b/examples/backup/outputs.tf index 4d3a158..ffa3674 100644 --- a/examples/backup/outputs.tf +++ b/examples/backup/outputs.tf @@ -1,17 +1,12 @@ ############################################################################## # Outputs ############################################################################## -output "id" { - description = "Enterprise DB instance id" - value = var.enterprise_db_backup_crn == null ? module.enterprise_db[0].id : null -} - -output "restored_enterprise_db_id" { +output "restored_icd_enterprise_db_id" { description = "Restored Enterprise DB instance id" - value = module.restored_enterprise_db.id + value = module.restored_icd_enterprise_db.id } -output "restored_enterprise_db_version" { +output "restored_icd_enterprise_db_version" { description = "Restored Enterprise DB instance version" - value = module.restored_enterprise_db.version + value = module.restored_icd_enterprise_db.version } diff --git a/examples/backup/variables.tf b/examples/backup/variables.tf index 12f9cb0..efcdc66 100644 --- a/examples/backup/variables.tf +++ b/examples/backup/variables.tf @@ -40,7 +40,7 @@ variable "access_tags" { default = [] } -variable "enterprise_db_backup_crn" { +variable "existing_database_crn" { type = string description = "The existing CRN of a backup resource to restore from. If null then it will create a new instance first and then create another instance pointing to the backup of the first instance." default = null diff --git a/examples/basic/main.tf b/examples/basic/main.tf index 9648c4b..8698fa7 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -14,14 +14,21 @@ module "resource_group" { # ICD Enterprise database ############################################################################## -module "enterprise_db" { +module "database" { source = "../.." resource_group_id = module.resource_group.resource_group_id name = "${var.prefix}-edb" edb_version = var.edb_version region = var.region - resource_tags = var.resource_tags + tags = var.resource_tags access_tags = var.access_tags + service_endpoints = var.service_endpoints + service_credential_names = { + "enterprisedb_admin" : "Administrator", + "enterprisedb_operator" : "Operator", + "enterprisedb_viewer" : "Viewer", + "enterprisedb_editor" : "Editor", + } } ############################################################################## @@ -34,10 +41,10 @@ module "read_only_replica_enterprise_db" { resource_group_id = module.resource_group.resource_group_id name = "${var.prefix}-read-only-replica-${count.index}" region = var.region - resource_tags = var.resource_tags + tags = var.resource_tags access_tags = var.access_tags edb_version = var.edb_version - remote_leader_crn = module.enterprise_db.crn - member_memory_mb = 4096 # The minimum size of a read-only replica is 3 GB RAM - member_disk_mb = 61440 # The minimum size of a read-only replica is 60 GB of disk + remote_leader_crn = module.database.crn + memory_mb = 4096 # The minimum size of a read-only replica is 3 GB RAM + disk_mb = 61440 # The minimum size of a read-only replica is 60 GB of disk } diff --git a/examples/basic/outputs.tf b/examples/basic/outputs.tf index 6612a4a..6cc1677 100644 --- a/examples/basic/outputs.tf +++ b/examples/basic/outputs.tf @@ -3,31 +3,36 @@ ############################################################################## output "id" { description = "Enterprise DB instance id" - value = module.enterprise_db.id + value = module.database.id +} + +output "enterprise_db_crn" { + description = "Enterprise database CRN" + value = module.database.crn } output "version" { description = "Enterprise DB instance version" - value = module.enterprise_db.version + value = module.database.version } output "adminuser" { description = "Database admin user name" - value = module.enterprise_db.adminuser + value = module.database.adminuser } output "hostname" { description = "Database connection hostname" - value = module.enterprise_db.hostname + value = module.database.hostname } output "port" { description = "Database connection port" - value = module.enterprise_db.port + value = module.database.port } output "certificate_base64" { description = "Database connection certificate" - value = module.enterprise_db.certificate_base64 + value = module.database.certificate_base64 sensitive = true } diff --git a/examples/basic/variables.tf b/examples/basic/variables.tf index 6283f24..98a1dad 100644 --- a/examples/basic/variables.tf +++ b/examples/basic/variables.tf @@ -40,6 +40,17 @@ variable "access_tags" { default = [] } +variable "service_endpoints" { + type = string + description = "The type of endpoint of the database instance. Possible values: `public`, `private`, `public-and-private`." + default = "public" + + validation { + condition = can(regex("public|public-and-private|private", var.service_endpoints)) + error_message = "Valid values for service_endpoints are 'public', 'public-and-private', and 'private'" + } +} + variable "read_only_replicas_count" { type = number description = "Number of read-only replicas per leader" diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 4dc7b4a..25219ea 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -96,7 +96,7 @@ module "enterprise_db" { edb_version = var.edb_version admin_pass = var.admin_pass users = var.users - resource_tags = var.resource_tags + tags = var.resource_tags # Example of how to use different KMS keys for data and backups use_ibm_owned_encryption_key = false use_same_kms_key_for_backups = false diff --git a/examples/complete/outputs.tf b/examples/complete/outputs.tf index c6cdf12..97a0f2c 100644 --- a/examples/complete/outputs.tf +++ b/examples/complete/outputs.tf @@ -28,11 +28,6 @@ output "service_credentials_object" { sensitive = true } -output "cbr_rule_ids" { - description = "CBR rule ids created to restrict Enterprise DB" - value = module.enterprise_db.cbr_rule_ids -} - output "hostname" { description = "EnterpriseDB instance hostname" value = module.enterprise_db.hostname diff --git a/examples/fscloud/main.tf b/examples/fscloud/main.tf index 6bd04fb..d955523 100644 --- a/examples/fscloud/main.tf +++ b/examples/fscloud/main.tf @@ -59,7 +59,7 @@ module "enterprise_db" { name = "${var.prefix}-edb" region = var.region edb_version = var.edb_version - resource_tags = var.resource_tags + tags = var.resource_tags kms_key_crn = var.kms_key_crn backup_encryption_key_crn = var.backup_encryption_key_crn backup_crn = var.backup_crn diff --git a/examples/fscloud/outputs.tf b/examples/fscloud/outputs.tf index 743d3e9..bf685b0 100644 --- a/examples/fscloud/outputs.tf +++ b/examples/fscloud/outputs.tf @@ -11,11 +11,6 @@ output "guid" { value = module.enterprise_db.guid } -output "version" { - description = "Enterprise DB instance version" - value = module.enterprise_db.version -} - output "hostname" { description = "Database hostname. Only contains value when var.service_credential_names or var.users are set." value = module.enterprise_db.hostname diff --git a/examples/pitr/main.tf b/examples/pitr/main.tf index 02d123e..a0b9ab6 100644 --- a/examples/pitr/main.tf +++ b/examples/pitr/main.tf @@ -10,24 +10,20 @@ module "resource_group" { existing_resource_group_name = var.resource_group } -data "ibm_database_point_in_time_recovery" "database_pitr" { - deployment_id = var.pitr_id -} - # New ICD enterprise database instance pointing to a PITR time module "enterprise_db_pitr" { source = "../.." resource_group_id = module.resource_group.resource_group_id name = "${var.prefix}-edb-pitr" region = var.region - resource_tags = var.resource_tags + tags = var.resource_tags access_tags = var.access_tags member_host_flavor = "b3c.4x16.encrypted" - member_memory_mb = 4096 # 1*3*1024 - member_disk_mb = 61440 # 3*20**1024 - member_cpu_count = 9 + memory_mb = 4096 # 1*3*1024 + disk_mb = 61440 # 3*20**1024 + cpu_count = 9 members = var.members edb_version = var.edb_version pitr_id = var.pitr_id - pitr_time = data.ibm_database_point_in_time_recovery.database_pitr.earliest_point_in_time_recovery_time + pitr_time = var.pitr_time == "" ? " " : var.pitr_time } diff --git a/examples/pitr/outputs.tf b/examples/pitr/outputs.tf index 86e81a0..8b0f90c 100644 --- a/examples/pitr/outputs.tf +++ b/examples/pitr/outputs.tf @@ -14,5 +14,5 @@ output "pitr_enterprise_db_version" { output "pitr_time" { description = "PITR timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) used to create PITR instance" - value = data.ibm_database_point_in_time_recovery.database_pitr.earliest_point_in_time_recovery_time + value = var.pitr_time } diff --git a/examples/pitr/variables.tf b/examples/pitr/variables.tf index 2389781..6898a7f 100644 --- a/examples/pitr/variables.tf +++ b/examples/pitr/variables.tf @@ -45,6 +45,11 @@ variable "pitr_id" { description = "The ID of the source deployment Enterprise DB instance that you want to recover back to. The Enterprise DB instance is expected to be in an up and running state." } +variable "pitr_time" { + type = string + description = "The timestamp in UTC format (%Y-%m-%dT%H:%M:%SZ) for any time in the last 7 days that you want to restore to. If empty string (\"\") or spaced string (\" \") is passed, latest_point_in_time_recovery_time will be used as pitr_time. To retrieve the timestamp, run the command (ibmcloud cdb postgresql earliest-pitr-timestamp ). For more info on Point-in-time Recovery, see https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-pitr" +} + variable "members" { type = number description = "Allocated number of members. Members must be same or higher than the source deployment Enterprise DB instance." diff --git a/main.tf b/main.tf index 1159790..a462ac2 100644 --- a/main.tf +++ b/main.tf @@ -180,7 +180,7 @@ resource "ibm_database" "enterprise_db" { backup_id = var.backup_crn remote_leader_id = var.remote_leader_crn version = var.edb_version - tags = var.resource_tags + tags = var.tags adminpassword = var.admin_pass service_endpoints = var.service_endpoints configuration = var.configuration != null ? jsonencode({ for k, v in var.configuration : k => v if v != null }) : null @@ -214,7 +214,7 @@ resource "ibm_database" "enterprise_db" { id = var.member_host_flavor } disk { - allocation_mb = var.member_disk_mb + allocation_mb = var.disk_mb } dynamic "members" { for_each = var.remote_leader_crn == null ? [1] : [] @@ -235,13 +235,13 @@ resource "ibm_database" "enterprise_db" { content { group_id = "member" # Only member type is allowed for IBM Cloud Databases memory { - allocation_mb = var.member_memory_mb + allocation_mb = var.memory_mb } disk { - allocation_mb = var.member_disk_mb + allocation_mb = var.disk_mb } cpu { - allocation_count = var.member_cpu_count + allocation_count = var.cpu_count } dynamic "members" { for_each = var.remote_leader_crn == null ? [1] : [] diff --git a/modules/fscloud/README.md b/modules/fscloud/README.md index 778d58a..56c94eb 100644 --- a/modules/fscloud/README.md +++ b/modules/fscloud/README.md @@ -35,21 +35,21 @@ No resources. | [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://ibm.biz/autoscaling-considerations 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
}))
| `[]` | 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
})))
operations = optional(list(object({
api_types = list(object({
api_type_id = string
}))
})))
}))
| `[]` | no | | [configuration](#input\_configuration) | Database configuration. [Learn more](https://cloud.ibm.com/apidocs/cloud-databases-api/cloud-databases-api-v4#setdatabaseconfiguration-request) |
object({
max_connections = optional(number)
max_prepared_transactions = optional(number)
deadlock_timeout = optional(number)
effective_io_concurrency = optional(number)
max_replication_slots = optional(number)
max_wal_senders = optional(number)
shared_buffers = optional(number)
synchronous_commit = optional(string)
wal_level = optional(string)
archive_timeout = optional(number)
log_min_duration_statement = optional(number)
})
| `null` | no | +| [cpu\_count](#input\_cpu\_count) | Allocated dedicated CPU per member. Minimum number of CPU allowed is 3. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `3` | no | +| [disk\_mb](#input\_disk\_mb) | Allocated disk per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `20480` | no | | [edb\_version](#input\_edb\_version) | Version of the Enterprise DB instance. If no value is passed, the current preferred version of IBM Cloud Databases is used. | `string` | `null` | no | | [kms\_key\_crn](#input\_kms\_key\_crn) | The CRN of a Key Protect or Hyper Protect Crypto Services encryption key to encrypt your data. Applies only if `use_ibm_owned_encryption_key` is false. By default this key is used for both deployment data and backups, but this behaviour can be altered using the `use_same_kms_key_for_backups` and `backup_encryption_key_crn` inputs. 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 | -| [member\_cpu\_count](#input\_member\_cpu\_count) | Allocated dedicated CPU per member. Minimum number of CPU allowed is 3. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `3` | no | -| [member\_disk\_mb](#input\_member\_disk\_mb) | Allocated disk per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `20480` | no | | [member\_host\_flavor](#input\_member\_host\_flavor) | Allocated host flavor per member. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/database#host_flavor). | `string` | `null` | no | -| [member\_memory\_mb](#input\_member\_memory\_mb) | Allocated memory per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `4096` | no | | [members](#input\_members) | Allocated number of members. Members can be scaled up but not down. | `number` | `3` | no | +| [memory\_mb](#input\_memory\_mb) | Allocated memory per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling) | `number` | `4096` | no | | [name](#input\_name) | The name given to the Enterprise DB instance. | `string` | n/a | yes | | [region](#input\_region) | The region where you want to deploy your instance. Must be the same region as the Hyper Protect Crypto Services instance. | `string` | `"us-south"` | no | | [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the Enterprise DB instance will be created. | `string` | n/a | yes | -| [resource\_tags](#input\_resource\_tags) | Optional list of tags to be added to the Enterprise DB instance. | `list(string)` | `[]` | no | | [service\_credential\_names](#input\_service\_credential\_names) | Map of name, role for service credentials that you want to create for the database | `map(string)` | `{}` | no | | [skip\_iam\_authorization\_policy](#input\_skip\_iam\_authorization\_policy) | Set to true to skip the creation of IAM authorization policies that permits all Databases for EnterpriseDB instances in the given resource group 'Reader' access to the Key Protect or Hyper Protect Crypto Services key that was provided in the `kms_key_crn` and `backup_encryption_key_crn` inputs. This policy is required in order to enable KMS encryption, so only skip creation if there is one already present in your account. No policy is created if `use_ibm_owned_encryption_key` is true. | `bool` | `false` | no | +| [tags](#input\_tags) | Optional list of tags to be added to the Enterprise DB instance. | `list(string)` | `[]` | no | | [use\_default\_backup\_encryption\_key](#input\_use\_default\_backup\_encryption\_key) | When `use_ibm_owned_encryption_key` is set to false, backups will be encrypted with either the key specified in `kms_key_crn`, or in `backup_encryption_key_crn` if a value is passed. If you do not want to use your own key for backups encryption, you can set this to `true` to use the IBM Cloud Databases default encryption for backups. Alternatively set `use_ibm_owned_encryption_key` to true to use the default encryption for both backups and deployment data. | `bool` | `false` | no | | [use\_ibm\_owned\_encryption\_key](#input\_use\_ibm\_owned\_encryption\_key) | Set to true to use the default IBM Cloud® Databases randomly generated keys for disk and backups encryption. To control the encryption keys, use the `kms_key_crn` and `backup_encryption_key_crn` inputs. | `string` | `false` | no | | [use\_same\_kms\_key\_for\_backups](#input\_use\_same\_kms\_key\_for\_backups) | Set this to false if you wan't to use a different key that you own to encrypt backups. When set to false, a value is required for the `backup_encryption_key_crn` input. Alternatiely set `use_default_backup_encryption_key` to true to use the IBM Cloud Databases default encryption. Applies only if `use_ibm_owned_encryption_key` is false. 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). | `bool` | `true` | no | diff --git a/modules/fscloud/main.tf b/modules/fscloud/main.tf index 66eae25..3d9158b 100644 --- a/modules/fscloud/main.tf +++ b/modules/fscloud/main.tf @@ -8,9 +8,9 @@ module "enterprise_db" { service_endpoints = "private" cbr_rules = var.cbr_rules configuration = var.configuration - member_cpu_count = var.member_cpu_count - member_memory_mb = var.member_memory_mb - member_disk_mb = var.member_disk_mb + cpu_count = var.cpu_count + memory_mb = var.memory_mb + disk_mb = var.disk_mb member_host_flavor = var.member_host_flavor members = var.members admin_pass = var.admin_pass @@ -23,6 +23,6 @@ module "enterprise_db" { backup_encryption_key_crn = var.backup_encryption_key_crn auto_scaling = var.auto_scaling access_tags = var.access_tags - resource_tags = var.resource_tags + tags = var.tags service_credential_names = var.service_credential_names } diff --git a/modules/fscloud/variables.tf b/modules/fscloud/variables.tf index 21f707f..84df112 100644 --- a/modules/fscloud/variables.tf +++ b/modules/fscloud/variables.tf @@ -34,13 +34,13 @@ variable "members" { default = 3 } -variable "member_cpu_count" { +variable "cpu_count" { type = number description = "Allocated dedicated CPU per member. Minimum number of CPU allowed is 3. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling)" default = 3 } -variable "member_disk_mb" { +variable "disk_mb" { type = number description = "Allocated disk per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling)" default = 20480 @@ -52,7 +52,7 @@ variable "member_host_flavor" { default = null } -variable "member_memory_mb" { +variable "memory_mb" { type = number description = "Allocated memory per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling)" default = 4096 @@ -83,7 +83,7 @@ variable "service_credential_names" { default = {} } -variable "resource_tags" { +variable "tags" { type = list(string) description = "Optional list of tags to be added to the Enterprise DB instance." default = [] @@ -215,6 +215,15 @@ variable "cbr_rules" { value = string }))) })) enforcement_mode = string + tags = optional(list(object({ + name = string + value = string + }))) + operations = optional(list(object({ + api_types = list(object({ + api_type_id = string + })) + }))) })) description = "(Optional, list) List of CBR rules to create" default = [] diff --git a/variables.tf b/variables.tf index 3e29f8f..d35f9e2 100644 --- a/variables.tf +++ b/variables.tf @@ -49,14 +49,14 @@ variable "members" { # Validation is done in the Terraform plan phase by the IBM provider, so no need to add extra validation here. } -variable "member_cpu_count" { +variable "cpu_count" { type = number description = "Allocated dedicated CPU per member. Minimum number of CPU allowed is 3. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling)" default = 3 # Validation is done in the Terraform plan phase by the IBM provider, so no need to add extra validation here. } -variable "member_disk_mb" { +variable "disk_mb" { type = number description = "Allocated disk per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling)" default = 20480 @@ -70,7 +70,7 @@ variable "member_host_flavor" { # Validation is done in the Terraform plan phase by the IBM provider, so no need to add extra validation here. } -variable "member_memory_mb" { +variable "memory_mb" { type = number description = "Allocated memory per member. [Learn more](https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling)" default = 4096 @@ -118,7 +118,7 @@ variable "service_endpoints" { } } -variable "resource_tags" { +variable "tags" { type = list(string) description = "Optional list of tags to be added to the Enterprise DB instance." default = []