Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
11 changes: 8 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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] : []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this may prevent scaling after restoring from a backup?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The restore from backup is a one time operation.

In order to scale after restoring from backup, the process should (must) pass null in the backup_crn. This would restore the group block (per previous behaviour).

content {
group_id = "member" # Only member type is allowed for IBM Cloud Databases
host_flavor {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -192,6 +195,8 @@ resource "ibm_database" "postgresql_db" {

timeouts {
create = "120m" # Extending provisioning time to 120 minutes
update = "120m"
delete = "15m"
}
}

Expand Down
4 changes: 2 additions & 2 deletions solutions/standard/DA-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion solutions/standard/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down