Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions infrastructure/modules/lambda/cloudwatch_log_group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@ resource "aws_cloudwatch_log_group" "main" {
},
)
}

resource "aws_cloudwatch_log_group" "main_edge" {
count = var.lambda_at_edge ? 1 : 0
name = "/aws/lambda/us-east-1.${local.csi}"
retention_in_days = var.log_retention_in_days
kms_key_id = var.kms_key_arn

tags = merge(
local.default_tags,
{
Name = local.csi
},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ data "aws_iam_policy_document" "put_logs" {
]

#trivy:ignore:aws-iam-no-policy-wildcards
resources = [
resources = flatten([[
"${aws_cloudwatch_log_group.main.arn}:*",
]
], var.lambda_at_edge ? [
"${aws_cloudwatch_log_group.main_edge[0].arn}:*",
] : []])
}

dynamic "statement" {
Expand Down
Loading