Skip to content

Commit 1010aa9

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 the following destroy and re-create, however there is no impact to any deployed infrastructure: (#346)
1 parent 2a84f41 commit 1010aa9

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
@@ -349,6 +349,10 @@ resource "time_sleep" "wait_for_mysql_authorization_policy" {
349349
count = local.create_secrets_manager_auth_policy
350350
depends_on = [ibm_iam_authorization_policy.secrets_manager_key_manager]
351351
create_duration = "30s"
352+
triggers = {
353+
secrets_manager_region = local.existing_secrets_manager_instance_region
354+
secrets_manager_guid = local.existing_secrets_manager_instance_guid
355+
}
352356
}
353357

354358
locals {
@@ -394,12 +398,12 @@ locals {
394398
}
395399

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

0 commit comments

Comments
 (0)