Skip to content

Commit 0184480

Browse files
Vipin KumarVipin Kumar
authored andcommitted
logic for cross account auth policy for cos kms
1 parent 8b6b932 commit 0184480

File tree

1 file changed

+3
-3
lines changed
  • solutions/fully-configurable

1 file changed

+3
-3
lines changed

solutions/fully-configurable/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ locals {
7272
target_ids = [module.activity_tracker.activity_tracker_targets[local.cloud_logs_target_name].id]
7373
}] : []
7474

75-
apply_auth_policy = (var.skip_cos_kms_auth_policy || (length(coalesce(local.buckets_config, [])) == 0 || !var.kms_encryption_enabled_buckets)) ? 0 : 1
76-
at_routes = concat(local.at_cos_route, local.at_cloud_logs_route)
75+
create_cross_account_auth_policy = !var.skip_cos_kms_auth_policy && var.ibmcloud_kms_api_key != null ? 1 : 0
76+
at_routes = concat(local.at_cos_route, local.at_cloud_logs_route)
7777

7878
}
7979

@@ -210,7 +210,7 @@ data "ibm_iam_account_settings" "iam_cos_account_settings" {
210210

211211
# Create IAM Authorization Policy to allow COS to access KMS for the encryption key
212212
resource "ibm_iam_authorization_policy" "policy" {
213-
count = local.apply_auth_policy
213+
count = local.create_cross_account_auth_policy
214214
# Conditionals with providers aren't possible, using ibm.kms as provider incase cross account is enabled
215215
provider = ibm.kms
216216
source_service_account = data.ibm_iam_account_settings.iam_cos_account_settings.account_id

0 commit comments

Comments
 (0)