Skip to content

Commit 16116f4

Browse files
committed
lock down iam roles
1 parent 5c20848 commit 16116f4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

terraform/modules/lambdas/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ resource "aws_iam_role" "api_role" {
3232
Effect = "Allow"
3333
Principal = {
3434
Service = "lambda.amazonaws.com"
35+
},
36+
Condition = {
37+
ArnLike = {
38+
"AWS:SourceArn" = [
39+
"arn:aws:lambda:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:function:${local.core_api_lambda_name}"
40+
]
41+
}
3542
}
3643
},
3744
]
@@ -48,6 +55,13 @@ resource "aws_iam_role" "sqs_consumer_role" {
4855
Effect = "Allow"
4956
Principal = {
5057
Service = "lambda.amazonaws.com"
58+
},
59+
Condition = {
60+
ArnLike = {
61+
"AWS:SourceArn" = [
62+
"arn:aws:lambda:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:function:${local.core_sqs_consumer_lambda_name}"
63+
]
64+
}
5165
}
5266
},
5367
]

0 commit comments

Comments
 (0)