From 06a04fab7c8fe270e3f1894a00ee72df038826b8 Mon Sep 17 00:00:00 2001 From: mrobinson1022 Date: Thu, 14 Sep 2023 15:34:46 -0400 Subject: [PATCH] chore: add ternary for access role --- main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index d21fd6f..1647ac4 100644 --- a/main.tf +++ b/main.tf @@ -232,7 +232,7 @@ resource "aws_dms_endpoint" "this" { include_transaction_details = try(kinesis_settings.value.include_transaction_details, null) message_format = try(kinesis_settings.value.message_format, null) partition_include_schema_table = try(kinesis_settings.value.partition_include_schema_table, null) - service_access_role_arn = lookup(kinesis_settings.value, "service_access_role_arn", aws_iam_role.access[0].arn) + service_access_role_arn = lookup(kinesis_settings.value, "service_access_role_arn", var.create_access_iam_role ? aws_iam_role.access[0].arn : null) stream_arn = lookup(kinesis_settings.value, "stream_arn", null) } } @@ -282,10 +282,10 @@ resource "aws_dms_endpoint" "this" { } } - secrets_manager_access_role_arn = lookup(each.value, "secrets_manager_arn", null) != null ? lookup(each.value, "secrets_manager_access_role_arn", aws_iam_role.access[0].arn) : null + secrets_manager_access_role_arn = lookup(each.value, "secrets_manager_arn", null) != null ? lookup(each.value, "secrets_manager_access_role_arn", var.create_access_iam_role ? aws_iam_role.access[0].arn : null) : null secrets_manager_arn = lookup(each.value, "secrets_manager_arn", null) server_name = lookup(each.value, "server_name", null) - service_access_role = lookup(each.value, "service_access_role", aws_iam_role.access[0].arn) + service_access_role = lookup(each.value, "service_access_role", var.create_access_iam_role ? aws_iam_role.access[0].arn : null) ssl_mode = try(each.value.ssl_mode, null) username = try(each.value.username, null) @@ -344,7 +344,7 @@ resource "aws_dms_s3_endpoint" "this" { rfc_4180 = try(each.value.rfc_4180, null) row_group_length = try(each.value.row_group_length, null) server_side_encryption_kms_key_id = lookup(each.value, "server_side_encryption_kms_key_id", null) - service_access_role_arn = lookup(each.value, "service_access_role_arn", aws_iam_role.access[0].arn) + service_access_role_arn = lookup(each.value, "service_access_role_arn", var.create_access_iam_role ? aws_iam_role.access[0].arn : null) timestamp_column_name = try(each.value.timestamp_column_name, null) use_csv_no_sup_value = try(each.value.use_csv_no_sup_value, null) use_task_start_time_for_full_load_timestamp = try(each.value.use_task_start_time_for_full_load_timestamp, null)