File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
infrastructure/terraform/components/api Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ module "authorizer_lambda" {
3131 log_destination_arn = local. destination_arn
3232 log_subscription_role_arn = local. acct . log_subscription_role_arn
3333
34+ depends_on = [aws_cloudwatch_log_group . api_gateway_execution ]
35+
3436 lambda_env_vars = {
3537 CLOUDWATCH_NAMESPACE = " /aws/api-gateway/supplier/alarms" ,
3638 CLIENT_CERTIFICATE_EXPIRATION_ALERT_DAYS = 14 ,
@@ -39,7 +41,7 @@ module "authorizer_lambda" {
3941 }
4042}
4143
42- data "aws_iam_policy_document" "authorizer_lambda " {
44+ data "aws_iam_policy_document" "authorizer_lambda_iam " {
4345 statement {
4446 sid = " AllowPutMetricData"
4547 effect = " Allow"
@@ -53,3 +55,25 @@ data "aws_iam_policy_document" "authorizer_lambda" {
5355 ]
5456 }
5557}
58+
59+ resource "aws_iam_policy" "authorizer_lambda_logging_policy" {
60+ name = " function-logging-policy"
61+ policy = jsonencode ({
62+ " Version" : " 2012-10-17" ,
63+ " Statement" : [
64+ {
65+ Action : [
66+ " logs:CreateLogStream" ,
67+ " logs:PutLogEvents"
68+ ],
69+ Effect : " Allow" ,
70+ Resource : " arn:aws:logs:*:*:*"
71+ }
72+ ]
73+ })
74+
75+ resource "aws_iam_role_policy_attachment" "authorizer_lambda_logging_policy_attachment" {
76+ role = aws_iam_role. authorizer_lambda_iam . id
77+ policy_arn = aws_iam_policy. authorizer_lambda_logging_policy
78+ }
79+ }
You can’t perform that action at this time.
0 commit comments