File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
infrastructure/stacks/api-layer Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,28 @@ resource "aws_cloudwatch_log_group" "waf" {
188188 ]
189189}
190190
191+ # CloudWatch Logs resource policy to allow WAF to write logs
192+ resource "aws_cloudwatch_log_resource_policy" "waf" {
193+ count = local. waf_enabled ? 1 : 0
194+ policy_name = " ${ local . workspace } -waf-logging-policy"
195+ policy_document = jsonencode ({
196+ Version = " 2012-10-17"
197+ Statement = [
198+ {
199+ Effect = " Allow"
200+ Principal = {
201+ Service = " delivery.logs.amazonaws.com"
202+ }
203+ Action = [
204+ " logs:CreateLogStream" ,
205+ " logs:PutLogEvents"
206+ ]
207+ Resource = " ${ aws_cloudwatch_log_group . waf [0 ]. arn } :*"
208+ }
209+ ]
210+ })
211+ }
212+
191213# KMS Key for WAF logs encryption
192214resource "aws_kms_key" "waf_logs" {
193215 count = local. waf_enabled ? 1 : 0
You can’t perform that action at this time.
0 commit comments