File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
terraform/modules/api_gateway Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,31 @@ resource "aws_iam_role_policy_attachment" "api_logs_apigateway_policy" {
5959 policy_arn = " arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"
6060}
6161
62+ resource "aws_iam_policy" "api_logs_subscription_policy" {
63+ name = " ${ var . short_prefix } -api-logs-subscription-policy"
64+ policy = jsonencode ({
65+ Version = " 2012-10-17" ,
66+ Statement = [
67+ {
68+ Sid = " AllowPutAPIGSubFilter"
69+ Effect = " Allow"
70+ Action = [
71+ " logs:PutSubscriptionFilter"
72+ ]
73+ Resource = [
74+ " arn:aws:logs:${ var . aws_region } :${ var . immunisation_account_id } :log-group:/aws/vendedlogs/${ aws_apigatewayv2_api . service_api . id } /${ var . sub_environment } :*" ,
75+ " arn:aws:logs:eu-west-2:693466633220:destination:api_gateway_log_destination"
76+ ]
77+ }
78+ ]
79+ })
80+ }
81+
82+ resource "aws_iam_role_policy_attachment" "api_logs_subscription_policy" {
83+ role = aws_iam_role. api_cloudwatch . name
84+ policy_arn = aws_iam_policy. api_logs_subscription_policy . arn
85+ }
86+
6287# TODO un-hardcode the region
6388# e.g.
6489# "logs.${data.aws_region.current.region}.amazonaws.com"
You can’t perform that action at this time.
0 commit comments