Skip to content

Commit

Permalink
fix: delay before using auth policy which is required as a workaround…
Browse files Browse the repository at this point in the history
… 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)
  • Loading branch information
shemau authored Jan 26, 2024
1 parent 122c2cf commit 472a353
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ locals {

# workaround for https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4478
resource "time_sleep" "wait_for_authorization_policy" {
depends_on = [ibm_iam_authorization_policy.policy]

depends_on = [ibm_iam_authorization_policy.policy]
count = local.create_access_policy_kms ? 1 : 0
create_duration = "30s"
}

Expand Down Expand Up @@ -122,7 +122,7 @@ resource "random_string" "bucket_name_suffix" {
# - Versioning
resource "ibm_cos_bucket" "cos_bucket" {
count = (var.kms_encryption_enabled && var.create_cos_bucket) ? 1 : 0
depends_on = [ibm_iam_authorization_policy.policy]
depends_on = [time_sleep.wait_for_authorization_policy]
bucket_name = var.add_bucket_name_suffix ? "${var.bucket_name}-${random_string.bucket_name_suffix[0].result}" : var.bucket_name
resource_instance_id = local.cos_instance_id
region_location = var.region
Expand Down Expand Up @@ -200,7 +200,7 @@ resource "ibm_cos_bucket" "cos_bucket" {
resource "ibm_cos_bucket" "cos_bucket1" {
count = (!var.kms_encryption_enabled && var.create_cos_bucket) ? 1 : 0
bucket_name = var.add_bucket_name_suffix ? "${var.bucket_name}-${random_string.bucket_name_suffix[0].result}" : var.bucket_name
depends_on = [ibm_iam_authorization_policy.policy]
depends_on = [time_sleep.wait_for_authorization_policy]
resource_instance_id = local.cos_instance_id
region_location = var.region
cross_region_location = var.cross_region_location
Expand Down

0 comments on commit 472a353

Please sign in to comment.