Skip to content

Commit 8c81268

Browse files
authored
Merge pull request #87 from NHSDigital/feature/CCM-10246_test
CCM-10246: Edge lambda regional log group
2 parents 7220cd4 + c61b7b0 commit 8c81268

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

infrastructure/modules/lambda/cloudwatch_log_group.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,17 @@ resource "aws_cloudwatch_log_group" "main" {
1010
},
1111
)
1212
}
13+
14+
resource "aws_cloudwatch_log_group" "main_edge" {
15+
count = var.lambda_at_edge ? 1 : 0
16+
name = "/aws/lambda/us-east-1.${local.csi}"
17+
retention_in_days = var.log_retention_in_days
18+
kms_key_id = var.kms_key_arn
19+
20+
tags = merge(
21+
local.default_tags,
22+
{
23+
Name = local.csi
24+
},
25+
)
26+
}

infrastructure/modules/lambda/data_iam_policy_document_put_logs.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ data "aws_iam_policy_document" "put_logs" {
99
]
1010

1111
#trivy:ignore:aws-iam-no-policy-wildcards
12-
resources = [
12+
resources = flatten([[
1313
"${aws_cloudwatch_log_group.main.arn}:*",
14-
]
14+
], var.lambda_at_edge ? [
15+
"${aws_cloudwatch_log_group.main_edge[0].arn}:*",
16+
] : []])
1517
}
1618

1719
dynamic "statement" {

0 commit comments

Comments
 (0)