Skip to content

Commit ee2ba8a

Browse files
committed
Another attempt
1 parent 02171b0 commit ee2ba8a

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

infrastructure/terraform/components/api/cloudwatch_log_group_api_gateway_execution.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,24 @@ resource "aws_iam_policy" "lambda_logging_policy" {
3131
]
3232
})
3333
}
34+
35+
resource "aws_iam_role" "lambda_role" {
36+
name = "lambda_role"
37+
assume_role_policy = <<EOF
38+
{
39+
"Version": "2012-10-17",
40+
"Statement": [{
41+
"Effect": "Allow",
42+
"Principal": {
43+
"Service": "lambda.amazonaws.com"
44+
},
45+
"Action": "sts:AssumeRole"
46+
}]
47+
}
48+
EOF
49+
}
50+
51+
resource "aws_iam_role_policy_attachment" "authorizer_lambda_logging_policy_attachment" {
52+
role = aws_iam_role.lambda_role.id
53+
policy_arn = aws_iam_policy.lambda_logging_policy
54+
}

infrastructure/terraform/components/api/module_authorizer_lambda.tf

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module "authorizer_lambda" {
1313

1414
function_name = "authorizer"
1515
description = "Authorizer for Suppliers API"
16+
role = aws_iam_role.lambda_role.arn
1617

1718
memory = 512
1819
timeout = 20
@@ -53,8 +54,3 @@ data "aws_iam_policy_document" "authorizer_lambda_iam" {
5354
]
5455
}
5556
}
56-
57-
resource "aws_iam_role_policy_attachment" "authorizer_lambda_logging_policy_attachment" {
58-
role = aws_iam_role.authorizer_lambda_iam.id
59-
policy_arn = aws_iam_policy.lambda_logging_policy
60-
}

0 commit comments

Comments
 (0)