Skip to content

Commit a3fc547

Browse files
feat: add missing configuration parameters and add validations for plan-time (#424)
Co-authored-by: Vincent Burckhardt <vincent.burckhardt@ie.ibm.com>
1 parent dbdfc3a commit a3fc547

File tree

6 files changed

+159
-40
lines changed

6 files changed

+159
-40
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ To attach access management tags to resources in this module, you need the follo
6565

6666
| Name | Source | Version |
6767
|------|--------|---------|
68-
| <a name="module_cbr_rule"></a> [cbr\_rule](#module\_cbr\_rule) | terraform-ibm-modules/cbr/ibm//modules/cbr-rule-module | 1.22.0 |
68+
| <a name="module_cbr_rule"></a> [cbr\_rule](#module\_cbr\_rule) | terraform-ibm-modules/cbr/ibm//modules/cbr-rule-module | 1.22.1 |
6969

7070
### Resources
7171

@@ -86,11 +86,11 @@ To attach access management tags to resources in this module, you need the follo
8686
| <a name="input_admin_pass"></a> [admin\_pass](#input\_admin\_pass) | The password for the database administrator. If the admin password is null then the admin user ID cannot be accessed. More users can be specified in a user block. | `string` | `null` | no |
8787
| <a name="input_auto_scaling"></a> [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. | <pre>object({<br> disk = object({<br> capacity_enabled = optional(bool, false)<br> free_space_less_than_percent = optional(number, 10)<br> io_above_percent = optional(number, 90)<br> io_enabled = optional(bool, false)<br> io_over_period = optional(string, "15m")<br> rate_increase_percent = optional(number, 10)<br> rate_limit_mb_per_member = optional(number, 3670016)<br> rate_period_seconds = optional(number, 900)<br> rate_units = optional(string, "mb")<br> })<br> memory = object({<br> io_above_percent = optional(number, 90)<br> io_enabled = optional(bool, false)<br> io_over_period = optional(string, "15m")<br> rate_increase_percent = optional(number, 10)<br> rate_limit_mb_per_member = optional(number, 114688)<br> rate_period_seconds = optional(number, 900)<br> rate_units = optional(string, "mb")<br> })<br> })</pre> | `null` | no |
8888
| <a name="input_backup_crn"></a> [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 |
89-
| <a name="input_backup_encryption_key_crn"></a> [backup\_encryption\_key\_crn](#input\_backup\_encryption\_key\_crn) | The CRN of a Key Protect key that you want to use for encrypting the disk that holds deployment backups. Only used if var.kms\_encryption\_enabled is set to true. BYOK for backups is available only in US regions us-south and us-east, and in eu-de. Only keys in the us-south and eu-de are durable to region failures. To ensure that your backups are available even if a region failure occurs, use a key from us-south or eu-de. Hyper Protect Crypto Services for IBM Cloud Databases backups is not currently supported. If no value is passed here, the value passed for the 'kms\_key\_crn' variable is used, unless 'use\_default\_backup\_encryption\_key' is set to 'true'. And if a HPCS value is passed for var.kms\_key\_crn, the database backup encryption uses the default encryption keys. | `string` | `null` | no |
89+
| <a name="input_backup_encryption_key_crn"></a> [backup\_encryption\_key\_crn](#input\_backup\_encryption\_key\_crn) | The CRN of a KMS (Key Protect or Hyper Protect Crypto Service) key to use for encrypting the disk that holds deployment backups. Only used if var.kms\_encryption\_enabled is set to true. There are limitation per region on the type of KMS service (Key Protect or Hyper Protect Crypto Services) and region for those services. See https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok and https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs#use-hpcs-backups | `string` | `null` | no |
9090
| <a name="input_cbr_rules"></a> [cbr\_rules](#input\_cbr\_rules) | (Optional, list) List of CBR 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> }))</pre> | `[]` | no |
91-
| <a name="input_configuration"></a> [configuration](#input\_configuration) | Database configuration | <pre>object({<br> max_connections = optional(number)<br> max_prepared_transactions = optional(number)<br> deadlock_timeout = optional(number)<br> effective_io_concurrency = optional(number)<br> max_replication_slots = optional(number)<br> max_wal_senders = optional(number)<br> shared_buffers = optional(number)<br> synchronous_commit = optional(string)<br> wal_level = optional(string)<br> archive_timeout = optional(number)<br> log_min_duration_statement = optional(number)<br> log_connections = optional(string)<br> log_disconnections = optional(string)<br> })</pre> | `null` | no |
91+
| <a name="input_configuration"></a> [configuration](#input\_configuration) | Database configuration parameters, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-changing-configuration&interface=api for more details. | <pre>object({<br> shared_buffers = optional(number)<br> max_connections = optional(number)<br> # below field gives error when sent to provider<br> # tracking issue: https://github.com/IBM-Cloud/terraform-provider-ibm/issues/5403<br> # max_locks_per_transaction = optional(number)<br> max_prepared_transactions = optional(number)<br> synchronous_commit = optional(string)<br> effective_io_concurrency = optional(number)<br> deadlock_timeout = optional(number)<br> log_connections = optional(string)<br> log_disconnections = optional(string)<br> log_min_duration_statement = optional(number)<br> tcp_keepalives_idle = optional(number)<br> tcp_keepalives_interval = optional(number)<br> tcp_keepalives_count = optional(number)<br> archive_timeout = optional(number)<br> wal_level = optional(string)<br> max_replication_slots = optional(number)<br> max_wal_senders = optional(number)<br> })</pre> | `null` | no |
9292
| <a name="input_existing_kms_instance_guid"></a> [existing\_kms\_instance\_guid](#input\_existing\_kms\_instance\_guid) | The GUID of the Hyper Protect Crypto Services or Key Protect instance in which the key specified in var.kms\_key\_crn and var.backup\_encryption\_key\_crn is coming from. Required only if var.kms\_encryption\_enabled is set to true, var.skip\_iam\_authorization\_policy is set to false, and you pass a value for var.kms\_key\_crn, var.backup\_encryption\_key\_crn, or both. | `string` | `null` | no |
93-
| <a name="input_kms_encryption_enabled"></a> [kms\_encryption\_enabled](#input\_kms\_encryption\_enabled) | Set this to true to control the encryption keys used to encrypt the data that you store in IBM Cloud® Databases. If set to false, the data is encrypted by using randomly generated keys. For more info on Key Protect integration, see https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect. For more info on HPCS integration, see https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs | `bool` | `false` | no |
93+
| <a name="input_kms_encryption_enabled"></a> [kms\_encryption\_enabled](#input\_kms\_encryption\_enabled) | Set this to true to control the encryption keys used to encrypt the data that you store in IBM Cloud Databases. If set to false, the data is encrypted by using randomly generated keys. For more info on Key Protect integration, see https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect. For more info on HPCS integration, see https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-hpcs | `bool` | `false` | no |
9494
| <a name="input_kms_key_crn"></a> [kms\_key\_crn](#input\_kms\_key\_crn) | The root key CRN of a Key Management Services like Key Protect or Hyper Protect Crypto Services (HPCS) that you want to use for disk encryption. Only used if var.kms\_encryption\_enabled is set to true. | `string` | `null` | no |
9595
| <a name="input_member_cpu_count"></a> [member\_cpu\_count](#input\_member\_cpu\_count) | Allocated dedicated CPU per member. For shared CPU, set to 0. For more information, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-resources-scaling | `number` | `0` | no |
9696
| <a name="input_member_disk_mb"></a> [member\_disk\_mb](#input\_member\_disk\_mb) | Allocated disk per member. For more information, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-resources-scaling | `number` | `5120` | no |

examples/complete/main.tf

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module "resource_group" {
1616

1717
module "key_protect_all_inclusive" {
1818
source = "terraform-ibm-modules/kms-all-inclusive/ibm"
19-
version = "4.11.8"
19+
version = "4.13.0"
2020
resource_group_id = module.resource_group.resource_group_id
2121
# Note: Database instance and Key Protect must be created in the same region when using BYOK
2222
# See https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok
@@ -28,7 +28,8 @@ module "key_protect_all_inclusive" {
2828
key_ring_name = "icd-pg"
2929
keys = [
3030
{
31-
key_name = "${var.prefix}-pg"
31+
key_name = "${var.prefix}-pg"
32+
force_delete = true
3233
}
3334
]
3435
}
@@ -105,8 +106,25 @@ module "postgresql_db" {
105106
resource_tags = var.resource_tags
106107
service_credential_names = var.service_credential_names
107108
access_tags = var.access_tags
109+
# Example of setting configuration - none of the below is mandatory - those settings are set in this example for illustation purpose and ensure path is exercised in automated test using this example.
108110
configuration = {
109-
max_connections = 250
111+
shared_buffers = 32000
112+
max_connections = 250
113+
max_locks_per_transaction = 64
114+
max_prepared_transactions = 0
115+
synchronous_commit = "local"
116+
effective_io_concurrency = 12
117+
deadlock_timeout = 10000
118+
log_connections = "off"
119+
log_disconnections = "off"
120+
log_min_duration_statement = 100
121+
tcp_keepalives_idle = 200
122+
tcp_keepalives_interval = 50
123+
tcp_keepalives_count = 6
124+
archive_timeout = 1000
125+
wal_level = "hot_standby"
126+
max_replication_slots = 10
127+
max_wal_senders = 20
110128
}
111129
cbr_rules = [
112130
{
@@ -140,7 +158,7 @@ resource "time_sleep" "wait_120_seconds" {
140158

141159
module "vpe" {
142160
source = "terraform-ibm-modules/vpe-gateway/ibm"
143-
version = "4.1.1"
161+
version = "4.1.3"
144162
prefix = "vpe-to-pg"
145163
cloud_service_by_crn = [
146164
{

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ resource "ibm_resource_tag" "postgresql_tag" {
208208
module "cbr_rule" {
209209
count = length(var.cbr_rules) > 0 ? length(var.cbr_rules) : 0
210210
source = "terraform-ibm-modules/cbr/ibm//modules/cbr-rule-module"
211-
version = "1.22.0"
211+
version = "1.22.1"
212212
rule_description = var.cbr_rules[count.index].description
213213
enforcement_mode = var.cbr_rules[count.index].enforcement_mode
214214
rule_contexts = var.cbr_rules[count.index].rule_contexts

modules/fscloud/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ No resources.
3535
| <a name="input_auto_scaling"></a> [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. | <pre>object({<br> disk = object({<br> capacity_enabled = optional(bool, false)<br> free_space_less_than_percent = optional(number, 10)<br> io_above_percent = optional(number, 90)<br> io_enabled = optional(bool, false)<br> io_over_period = optional(string, "15m")<br> rate_increase_percent = optional(number, 10)<br> rate_limit_mb_per_member = optional(number, 3670016)<br> rate_period_seconds = optional(number, 900)<br> rate_units = optional(string, "mb")<br> })<br> memory = object({<br> io_above_percent = optional(number, 90)<br> io_enabled = optional(bool, false)<br> io_over_period = optional(string, "15m")<br> rate_increase_percent = optional(number, 10)<br> rate_limit_mb_per_member = optional(number, 114688)<br> rate_period_seconds = optional(number, 900)<br> rate_units = optional(string, "mb")<br> })<br> })</pre> | `null` | no |
3636
| <a name="input_backup_crn"></a> [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 |
3737
| <a name="input_cbr_rules"></a> [cbr\_rules](#input\_cbr\_rules) | (Optional, list) List of CBR 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> }))</pre> | `[]` | no |
38-
| <a name="input_configuration"></a> [configuration](#input\_configuration) | Database configuration. | <pre>object({<br> max_connections = optional(number)<br> max_prepared_transactions = optional(number)<br> deadlock_timeout = optional(number)<br> effective_io_concurrency = optional(number)<br> max_replication_slots = optional(number)<br> max_wal_senders = optional(number)<br> shared_buffers = optional(number)<br> synchronous_commit = optional(string)<br> wal_level = optional(string)<br> archive_timeout = optional(number)<br> log_min_duration_statement = optional(number)<br> log_connections = optional(string)<br> log_disconnections = optional(string)<br> })</pre> | `null` | no |
38+
| <a name="input_configuration"></a> [configuration](#input\_configuration) | Database configuration parameters, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-changing-configuration&interface=api for more details. | <pre>object({<br> shared_buffers = optional(number)<br> max_connections = optional(number)<br> # below field gives error when sent to provider<br> # tracking issue: https://github.com/IBM-Cloud/terraform-provider-ibm/issues/5403<br> # max_locks_per_transaction = optional(number)<br> max_prepared_transactions = optional(number)<br> synchronous_commit = optional(string)<br> effective_io_concurrency = optional(number)<br> deadlock_timeout = optional(number)<br> log_connections = optional(string)<br> log_disconnections = optional(string)<br> log_min_duration_statement = optional(number)<br> tcp_keepalives_idle = optional(number)<br> tcp_keepalives_interval = optional(number)<br> tcp_keepalives_count = optional(number)<br> archive_timeout = optional(number)<br> wal_level = optional(string)<br> max_replication_slots = optional(number)<br> max_wal_senders = optional(number)<br> })</pre> | `null` | no |
3939
| <a name="input_existing_kms_instance_guid"></a> [existing\_kms\_instance\_guid](#input\_existing\_kms\_instance\_guid) | The GUID of the Hyper Protect Crypto Services instance. | `string` | n/a | yes |
4040
| <a name="input_kms_key_crn"></a> [kms\_key\_crn](#input\_kms\_key\_crn) | The root key CRN of the Hyper Protect Crypto Service (HPCS) to use for disk encryption. | `string` | n/a | yes |
4141
| <a name="input_member_cpu_count"></a> [member\_cpu\_count](#input\_member\_cpu\_count) | Allocated dedicated CPU per member. For shared CPU, set to 0. For more information, see https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-resources-scaling | `number` | `3` | no |

0 commit comments

Comments
 (0)