Skip to content

Commit c8bb228

Browse files
committed
fix sqs send policy
1 parent 83de4b5 commit c8bb228

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

terraform/modules/lambdas/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ resource "aws_iam_policy" "api_only_policy" {
119119
Effect = "Allow",
120120
Action = ["sqs:SendMessage"],
121121
Resource = [
122-
"arn:aws:sqs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:infra-core-api-*",
122+
"arn:aws:sqs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${var.ProjectId}-*",
123123
]
124124
}
125125
]
@@ -294,8 +294,9 @@ resource "aws_iam_policy" "shared_iam_policy" {
294294
}
295295

296296
resource "aws_iam_role_policy_attachment" "api_attach" {
297+
for_each = toset([aws_iam_policy.shared_iam_policy.arn, aws_iam_policy.api_only_policy.arn])
297298
role = aws_iam_role.api_role.name
298-
policy_arn = aws_iam_policy.shared_iam_policy.arn
299+
policy_arn = each.key
299300
}
300301

301302
resource "aws_iam_role_policy_attachment" "entra_attach" {

0 commit comments

Comments
 (0)