diff --git a/data.tf b/data.tf index e8107bc..4a8173c 100644 --- a/data.tf +++ b/data.tf @@ -115,17 +115,17 @@ data "aws_iam_policy_document" "runtask_key" { principals { type = "Service" identifiers = [ - "logs.${data.aws_region.current_region.name}.amazonaws.com" + "logs.${data.aws_region.current_region.region}.amazonaws.com" ] } condition { test = "ArnEquals" variable = "kms:EncryptionContext:aws:logs:arn" values = [ - "arn:${data.aws_partition.current_partition.id}:logs:${data.aws_region.current_region.name}:${data.aws_caller_identity.current_account.account_id}:log-group:/aws/lambda/${local.solution_prefix}*", - "arn:${data.aws_partition.current_partition.id}:logs:${data.aws_region.current_region.name}:${data.aws_caller_identity.current_account.account_id}:log-group:/aws/state/${local.solution_prefix}*", - "arn:${data.aws_partition.current_partition.id}:logs:${data.aws_region.current_region.name}:${data.aws_caller_identity.current_account.account_id}:log-group:/aws/vendedlogs/states/${local.solution_prefix}*", - "arn:${data.aws_partition.current_partition.id}:logs:${data.aws_region.current_region.name}:${data.aws_caller_identity.current_account.account_id}:log-group:${var.cloudwatch_log_group_name}*" + "arn:${data.aws_partition.current_partition.id}:logs:${data.aws_region.current_region.region}:${data.aws_caller_identity.current_account.account_id}:log-group:/aws/lambda/${local.solution_prefix}*", + "arn:${data.aws_partition.current_partition.id}:logs:${data.aws_region.current_region.region}:${data.aws_caller_identity.current_account.account_id}:log-group:/aws/state/${local.solution_prefix}*", + "arn:${data.aws_partition.current_partition.id}:logs:${data.aws_region.current_region.region}:${data.aws_caller_identity.current_account.account_id}:log-group:/aws/vendedlogs/states/${local.solution_prefix}*", + "arn:${data.aws_partition.current_partition.id}:logs:${data.aws_region.current_region.region}:${data.aws_caller_identity.current_account.account_id}:log-group:${var.cloudwatch_log_group_name}*" ] } } @@ -152,7 +152,7 @@ data "aws_iam_policy_document" "runtask_key" { test = "StringEquals" variable = "kms:ViaService" values = [ - "secretsmanager.${data.aws_region.current_region.name}.amazonaws.com" + "secretsmanager.${data.aws_region.current_region.region}.amazonaws.com" ] } diff --git a/examples/basic/main.tf b/examples/basic/main.tf index 10aff63..e8a2d7a 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -12,7 +12,7 @@ data "tfe_organization" "hcp_tf_org" { module "hcp_tf_run_task" { source = "../.." - aws_region = data.aws_region.current.name + aws_region = data.aws_region.current.region hcp_tf_org = data.tfe_organization.hcp_tf_org.name run_task_iam_roles = var.tf_run_task_logic_iam_roles deploy_waf = true diff --git a/iam.tf b/iam.tf index de073d9..5cbc897 100644 --- a/iam.tf +++ b/iam.tf @@ -28,7 +28,7 @@ resource "aws_iam_role_policy" "runtask_eventbridge" { name = "${local.solution_prefix}-runtask-eventbridge-policy" role = aws_iam_role.runtask_eventbridge.id policy = templatefile("${path.module}/templates/role-policies/runtask-eventbridge-lambda-role-policy.tpl", { - data_aws_region = data.aws_region.current_region.name + data_aws_region = data.aws_region.current_region.region data_aws_account_id = data.aws_caller_identity.current_account.account_id data_aws_partition = data.aws_partition.current_partition.partition var_event_bus_name = var.event_bus_name @@ -92,7 +92,7 @@ resource "aws_iam_role_policy" "runtask_fulfillment" { name = "${local.solution_prefix}-runtask-fulfillment-policy" role = aws_iam_role.runtask_fulfillment.id policy = templatefile("${path.module}/templates/role-policies/runtask-fulfillment-lambda-role-policy.tpl", { - data_aws_region = data.aws_region.current_region.name + data_aws_region = data.aws_region.current_region.region data_aws_account_id = data.aws_caller_identity.current_account.account_id data_aws_partition = data.aws_partition.current_partition.partition local_log_group_name = local.cloudwatch_log_group_name @@ -110,7 +110,7 @@ resource "aws_iam_role_policy" "runtask_states" { name = "${local.solution_prefix}-runtask-statemachine-policy" role = aws_iam_role.runtask_states.id policy = templatefile("${path.module}/templates/role-policies/runtask-state-role-policy.tpl", { - data_aws_region = data.aws_region.current_region.name + data_aws_region = data.aws_region.current_region.region data_aws_account_id = data.aws_caller_identity.current_account.account_id data_aws_partition = data.aws_partition.current_partition.partition var_name_prefix = var.name_prefix