Skip to content

Commit 21c0b23

Browse files
authored
fix: added workaround to ensure group config is not set when provisioning using a backup CRN.<br>- fixed bug in DA where wal_level config setting was incorrectly set to hot_standby. Its now set to replica which is a valid option.(#508)
1 parent c32c49c commit 21c0b23

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

examples/complete/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module "postgresql_db" {
123123
tcp_keepalives_interval = 50
124124
tcp_keepalives_count = 6
125125
archive_timeout = 1000
126-
wal_level = "hot_standby"
126+
wal_level = "replica"
127127
max_replication_slots = 10
128128
max_wal_senders = 20
129129
}

main.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,14 @@ resource "ibm_database" "postgresql_db" {
8282
}
8383
}
8484

85+
# Workaround for https://github.ibm.com/GoldenEye/issues/issues/11359
86+
# means that no `group` block is added when restoring from backup
87+
8588
## This for_each block is NOT a loop to attach to multiple group blocks.
8689
## This is used to conditionally add one, OR, the other group block depending on var.local.host_flavor_set
8790
## This block is for if host_flavor IS set to specific pre-defined host sizes and not set to "multitenant"
8891
dynamic "group" {
89-
for_each = local.host_flavor_set && var.member_host_flavor != "multitenant" ? [1] : []
92+
for_each = local.host_flavor_set && var.member_host_flavor != "multitenant" && var.backup_crn == null ? [1] : []
9093
content {
9194
group_id = "member" # Only member type is allowed for IBM Cloud Databases
9295
host_flavor {
@@ -106,7 +109,7 @@ resource "ibm_database" "postgresql_db" {
106109

107110
## This block is for if host_flavor IS set to "multitenant"
108111
dynamic "group" {
109-
for_each = local.host_flavor_set && var.member_host_flavor == "multitenant" ? [1] : []
112+
for_each = local.host_flavor_set && var.member_host_flavor == "multitenant" && var.backup_crn == null ? [1] : []
110113
content {
111114
group_id = "member" # Only member type is allowed for IBM Cloud Databases
112115
host_flavor {
@@ -132,7 +135,7 @@ resource "ibm_database" "postgresql_db" {
132135

133136
## This block is for if host_flavor IS NOT set
134137
dynamic "group" {
135-
for_each = local.host_flavor_set ? [] : [1]
138+
for_each = local.host_flavor_set && var.backup_crn == null ? [] : [1]
136139
content {
137140
group_id = "member" # Only member type is allowed for IBM Cloud Databases
138141
memory {
@@ -192,6 +195,8 @@ resource "ibm_database" "postgresql_db" {
192195

193196
timeouts {
194197
create = "120m" # Extending provisioning time to 120 minutes
198+
update = "120m"
199+
delete = "15m"
195200
}
196201
}
197202

solutions/standard/DA-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ The configuration object in the input contains the following options categorized
162162
**3. WAL Settings. [Learn more](https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-changing-configuration&interface=cli#wal-settings).**
163163

164164
- `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`)
165-
- `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`)
165+
- `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`)
166166
- `max_replication_slots`: Specifies the maximum number of replication slots, which are used for streaming replication and logical decoding. (default: `10`)
167167
- `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`)
168168

@@ -185,7 +185,7 @@ The following example shows values for the `configuration` input.
185185
"tcp_keepalives_interval": 15,
186186
"tcp_keepalives_count": 6,
187187
"archive_timeout": 1800,
188-
"wal_level": "hot_standby",
188+
"wal_level": "replica",
189189
"max_replication_slots": 10,
190190
"max_wal_senders": 12
191191
}

solutions/standard/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ variable "configuration" {
159159
tcp_keepalives_interval = 15
160160
tcp_keepalives_count = 6
161161
archive_timeout = 1800
162-
wal_level = "hot_standby"
162+
wal_level = "replica"
163163
max_replication_slots = 10
164164
max_wal_senders = 12
165165
}

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ variable "configuration" {
203203
}
204204

205205
validation {
206-
condition = var.configuration != null ? (var.configuration["wal_level"] != null ? contains(["hot_standby", "logical"], var.configuration["wal_level"]) : true) : true
207-
error_message = "Value for `configuration[\"wal_level\"]` must be either `hot_standby` or `logical`, if specified."
206+
condition = var.configuration != null ? (var.configuration["wal_level"] != null ? contains(["replica", "logical"], var.configuration["wal_level"]) : true) : true
207+
error_message = "Value for `configuration[\"wal_level\"]` must be either `replica` or `logical`, if specified."
208208
}
209209

210210
validation {

0 commit comments

Comments
 (0)