Skip to content
Merged
Changes from 1 commit
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
9 changes: 6 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