Skip to content

Commit d9d097d

Browse files
authored
chore: added workaround to basic example (#260)
1 parent 2a08065 commit d9d097d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

examples/basic/main.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ module "postgresql_db" {
2424
access_tags = var.access_tags
2525
}
2626

27+
# On destroy, we are seeing that even though the replica has been returned as
28+
# destroyed by terraform, the leader instance destroy can fail with: "You
29+
# must delete all replicas before disabling the leader. Try again with valid
30+
# values or contact support if the issue persists."
31+
# The ICD team have recommended to wait for a period of time after the replica
32+
# destroy completes before attempting to destroy the leader instance, so hence
33+
# adding a time sleep here.
34+
35+
resource "time_sleep" "wait_time" {
36+
depends_on = [module.postgresql_db]
37+
38+
destroy_duration = "5m"
39+
}
40+
2741
##############################################################################
2842
# ICD postgresql read-only-replica
2943
##############################################################################
@@ -40,4 +54,5 @@ module "read_only_replica_postgresql_db" {
4054
remote_leader_crn = module.postgresql_db.crn
4155
member_memory_mb = 2304 # Must be an increment of 384 megabytes. The minimum size of a read-only replica is 2 GB RAM
4256
member_disk_mb = 15360 # Must be an increment of 512 megabytes. The minimum size of a read-only replica is 15.36 GB of disk
57+
depends_on = [time_sleep.wait_time]
4358
}

examples/basic/version.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ terraform {
66
source = "IBM-Cloud/ibm"
77
version = "1.54.0"
88
}
9+
10+
time = {
11+
source = "hashicorp/time"
12+
version = "0.9.1"
13+
}
914
}
1015
}

0 commit comments

Comments
 (0)