Skip to content

Commit 472a353

Browse files
authored
fix: delay before using auth policy which is required as a workaround for this provider [issue](IBM-Cloud/terraform-provider-ibm#4478). NOTE: Upgrades from earlier to version to this version may show a time_sleep.wait_for_authorization_policy being deleted if they are skipping authorisation policy creation. This is expected, since there is no need to delay if the authorisation policy already exists. (#518)
1 parent 122c2cf commit 472a353

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ locals {
3737

3838
# workaround for https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4478
3939
resource "time_sleep" "wait_for_authorization_policy" {
40-
depends_on = [ibm_iam_authorization_policy.policy]
41-
40+
depends_on = [ibm_iam_authorization_policy.policy]
41+
count = local.create_access_policy_kms ? 1 : 0
4242
create_duration = "30s"
4343
}
4444

@@ -122,7 +122,7 @@ resource "random_string" "bucket_name_suffix" {
122122
# - Versioning
123123
resource "ibm_cos_bucket" "cos_bucket" {
124124
count = (var.kms_encryption_enabled && var.create_cos_bucket) ? 1 : 0
125-
depends_on = [ibm_iam_authorization_policy.policy]
125+
depends_on = [time_sleep.wait_for_authorization_policy]
126126
bucket_name = var.add_bucket_name_suffix ? "${var.bucket_name}-${random_string.bucket_name_suffix[0].result}" : var.bucket_name
127127
resource_instance_id = local.cos_instance_id
128128
region_location = var.region
@@ -200,7 +200,7 @@ resource "ibm_cos_bucket" "cos_bucket" {
200200
resource "ibm_cos_bucket" "cos_bucket1" {
201201
count = (!var.kms_encryption_enabled && var.create_cos_bucket) ? 1 : 0
202202
bucket_name = var.add_bucket_name_suffix ? "${var.bucket_name}-${random_string.bucket_name_suffix[0].result}" : var.bucket_name
203-
depends_on = [ibm_iam_authorization_policy.policy]
203+
depends_on = [time_sleep.wait_for_authorization_policy]
204204
resource_instance_id = local.cos_instance_id
205205
region_location = var.region
206206
cross_region_location = var.cross_region_location

0 commit comments

Comments
 (0)