Skip to content

Commit 6b18dfc

Browse files
authored
fix: fix issue that was causing secrets manager managed service credential re-creation<br><br>NOTE: When upgrading from previous version, you will see time_sleep resource getting recreated. This doesn't destroy any actual infrastructure and is an expected change.(#732)
1 parent 486b157 commit 6b18dfc

File tree

1 file changed

+10
-6
lines changed
  • solutions/fully-configurable

1 file changed

+10
-6
lines changed

solutions/fully-configurable/main.tf

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ resource "time_sleep" "wait_for_postgresql_authorization_policy" {
350350
count = local.create_secrets_manager_auth_policy
351351
depends_on = [ibm_iam_authorization_policy.secrets_manager_key_manager]
352352
create_duration = "30s"
353+
triggers = {
354+
secrets_manager_region = local.existing_secrets_manager_instance_region
355+
secrets_manager_guid = local.existing_secrets_manager_instance_guid
356+
}
353357
}
354358

355359
locals {
@@ -395,12 +399,12 @@ locals {
395399
}
396400

397401
module "secrets_manager_service_credentials" {
398-
count = length(local.service_credential_secrets) > 0 ? 1 : 0
399-
depends_on = [time_sleep.wait_for_postgresql_authorization_policy]
400-
source = "terraform-ibm-modules/secrets-manager/ibm//modules/secrets"
401-
version = "2.10.2"
402-
existing_sm_instance_guid = local.existing_secrets_manager_instance_guid
403-
existing_sm_instance_region = local.existing_secrets_manager_instance_region
402+
count = length(local.service_credential_secrets) > 0 ? 1 : 0
403+
source = "terraform-ibm-modules/secrets-manager/ibm//modules/secrets"
404+
version = "2.10.2"
405+
# converted into implicit dependency and removed explicit depends_on time_sleep.wait_for_postgresql_authorization_policy for this module because of issue https://github.com/terraform-ibm-modules/terraform-ibm-icd-redis/issues/608
406+
existing_sm_instance_guid = local.create_secrets_manager_auth_policy > 0 ? time_sleep.wait_for_postgresql_authorization_policy[0].triggers["secrets_manager_guid"] : local.existing_secrets_manager_instance_guid
407+
existing_sm_instance_region = local.create_secrets_manager_auth_policy > 0 ? time_sleep.wait_for_postgresql_authorization_policy[0].triggers["secrets_manager_region"] : local.existing_secrets_manager_instance_region
404408
endpoint_type = var.existing_secrets_manager_endpoint_type
405409
secrets = local.secrets
406410
}

0 commit comments

Comments
 (0)