Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Commit 3ebbef5

Browse files
authored
fix: Add workaround to ignore groups config when provisioning instance using backup CRN (#293)
1 parent 4bc92b7 commit 3ebbef5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

main.tf

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ locals {
2727
# Determine if host_flavor is used
2828
host_flavor_set = var.member_host_flavor != null ? true : false
2929

30+
# Determine if restore, from backup or point in time recovery
31+
recovery_mode = var.backup_crn != null || var.pitr_id != null
32+
3033
# Determine what KMS service is being used for database encryption
3134
kms_service = var.kms_key_crn != null ? (
3235
can(regex(".*kms.*", var.kms_key_crn)) ? "kms" : (
@@ -84,11 +87,15 @@ resource "ibm_database" "enterprise_db" {
8487
}
8588
}
8689

90+
# Workaround for https://github.ibm.com/GoldenEye/issues/issues/11359
91+
# means that no `group` block is added when restoring from backup
92+
# or point in time recovery
93+
8794
## This for_each block is NOT a loop to attach to multiple group blocks.
8895
## This is used to conditionally add one, OR, the other group block depending on var.local.host_flavor_set
89-
## This block is for if host_flavor IS set to specific pre-defined host sizes and not set to "multitenant"
96+
## This block is for if host_flavor IS set to specific pre-defined host sizes
9097
dynamic "group" {
91-
for_each = local.host_flavor_set ? [1] : []
98+
for_each = local.host_flavor_set && !local.recovery_mode ? [1] : []
9299
content {
93100
group_id = "member" # Only member type is allowed for IBM Cloud Databases
94101
host_flavor {
@@ -112,7 +119,7 @@ resource "ibm_database" "enterprise_db" {
112119

113120
## This block is for if host_flavor IS NOT set
114121
dynamic "group" {
115-
for_each = local.host_flavor_set ? [] : [1]
122+
for_each = !local.host_flavor_set && !local.recovery_mode ? [1] : []
116123
content {
117124
group_id = "member" # Only member type is allowed for IBM Cloud Databases
118125
memory {
@@ -172,6 +179,8 @@ resource "ibm_database" "enterprise_db" {
172179

173180
timeouts {
174181
create = "120m" # Extending provisioning time to 120 minutes
182+
update = "120m"
183+
delete = "15m"
175184
}
176185
}
177186

0 commit comments

Comments
 (0)