From 3ee6504d96feee8a618a72d34734869c12248716 Mon Sep 17 00:00:00 2001 From: shemau Date: Mon, 4 Nov 2024 12:37:15 +0000 Subject: [PATCH 1/3] fix: workaround group on restore --- main.tf | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index b7c23533..9499a587 100644 --- a/main.tf +++ b/main.tf @@ -82,11 +82,14 @@ resource "ibm_database" "postgresql_db" { } } + # Workaround for https://github.ibm.com/GoldenEye/issues/issues/11359 + # means that no `group` block is added when restoring from backup + ## This for_each block is NOT a loop to attach to multiple group blocks. ## This is used to conditionally add one, OR, the other group block depending on var.local.host_flavor_set ## This block is for if host_flavor IS set to specific pre-defined host sizes and not set to "multitenant" dynamic "group" { - for_each = local.host_flavor_set && var.member_host_flavor != "multitenant" ? [1] : [] + for_each = local.host_flavor_set && var.member_host_flavor != "multitenant" && var.backup_crn == null ? [1] : [] content { group_id = "member" # Only member type is allowed for IBM Cloud Databases host_flavor { @@ -106,7 +109,7 @@ resource "ibm_database" "postgresql_db" { ## This block is for if host_flavor IS set to "multitenant" dynamic "group" { - for_each = local.host_flavor_set && var.member_host_flavor == "multitenant" ? [1] : [] + for_each = local.host_flavor_set && var.member_host_flavor == "multitenant" && var.backup_crn == null ? [1] : [] content { group_id = "member" # Only member type is allowed for IBM Cloud Databases host_flavor { @@ -132,7 +135,7 @@ resource "ibm_database" "postgresql_db" { ## This block is for if host_flavor IS NOT set dynamic "group" { - for_each = local.host_flavor_set ? [] : [1] + for_each = local.host_flavor_set && var.backup_crn == null ? [] : [1] content { group_id = "member" # Only member type is allowed for IBM Cloud Databases memory { From b5a0b4de03b07d177317351f2a56dc63befa27a3 Mon Sep 17 00:00:00 2001 From: shemau Date: Tue, 5 Nov 2024 09:49:43 +0000 Subject: [PATCH 2/3] fix: adjust timeouts --- main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.tf b/main.tf index 9499a587..aa7a1eee 100644 --- a/main.tf +++ b/main.tf @@ -195,6 +195,8 @@ resource "ibm_database" "postgresql_db" { timeouts { create = "120m" # Extending provisioning time to 120 minutes + update = "120m" + delete = "15m" } } From 7b83b3146e9beec060a47a74ce23fcab7e34333c Mon Sep 17 00:00:00 2001 From: shemau Date: Tue, 5 Nov 2024 15:21:34 +0000 Subject: [PATCH 3/3] fix: default wal_level must be replica or logical --- examples/complete/main.tf | 2 +- solutions/standard/DA-types.md | 4 ++-- solutions/standard/variables.tf | 2 +- variables.tf | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/complete/main.tf b/examples/complete/main.tf index f18894b4..800d2928 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -123,7 +123,7 @@ module "postgresql_db" { tcp_keepalives_interval = 50 tcp_keepalives_count = 6 archive_timeout = 1000 - wal_level = "hot_standby" + wal_level = "replica" max_replication_slots = 10 max_wal_senders = 20 } diff --git a/solutions/standard/DA-types.md b/solutions/standard/DA-types.md index a843a5dc..12c24c04 100644 --- a/solutions/standard/DA-types.md +++ b/solutions/standard/DA-types.md @@ -162,7 +162,7 @@ The configuration object in the input contains the following options categorized **3. WAL Settings. [Learn more](https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-changing-configuration&interface=cli#wal-settings).** - `archive_timeout`: Forces a switch to the next WAL file if no new file has been generated within the specified time. Useful for ensuring regular WAL archiving. (default: `1800`) -- `wal_level`: Sets the level of information written to the WAL. Higher levels, like replica or logical, are required for replication and logical decoding. (default: `hot_standby`) +- `wal_level`: Sets the level of information written to the WAL. Higher levels, like replica or logical, are required for replication and logical decoding. (default: `replica`) - `max_replication_slots`: Specifies the maximum number of replication slots, which are used for streaming replication and logical decoding. (default: `10`) - `max_wal_senders`: Determines the maximum number of concurrent WAL sender processes for streaming replication. Increasing this allows more standby servers to connect. (default: `12`) @@ -185,7 +185,7 @@ The following example shows values for the `configuration` input. "tcp_keepalives_interval": 15, "tcp_keepalives_count": 6, "archive_timeout": 1800, - "wal_level": "hot_standby", + "wal_level": "replica", "max_replication_slots": 10, "max_wal_senders": 12 } diff --git a/solutions/standard/variables.tf b/solutions/standard/variables.tf index 95451e77..35e9aa21 100644 --- a/solutions/standard/variables.tf +++ b/solutions/standard/variables.tf @@ -159,7 +159,7 @@ variable "configuration" { tcp_keepalives_interval = 15 tcp_keepalives_count = 6 archive_timeout = 1800 - wal_level = "hot_standby" + wal_level = "replica" max_replication_slots = 10 max_wal_senders = 12 } diff --git a/variables.tf b/variables.tf index e8da4935..1f74cc5e 100644 --- a/variables.tf +++ b/variables.tf @@ -203,8 +203,8 @@ variable "configuration" { } validation { - condition = var.configuration != null ? (var.configuration["wal_level"] != null ? contains(["hot_standby", "logical"], var.configuration["wal_level"]) : true) : true - error_message = "Value for `configuration[\"wal_level\"]` must be either `hot_standby` or `logical`, if specified." + condition = var.configuration != null ? (var.configuration["wal_level"] != null ? contains(["replica", "logical"], var.configuration["wal_level"]) : true) : true + error_message = "Value for `configuration[\"wal_level\"]` must be either `replica` or `logical`, if specified." } validation {