Skip to content

Commit

Permalink
adding log group resource group to demonstrate not leaving behind tes…
Browse files Browse the repository at this point in the history
…t resources
  • Loading branch information
haitchison committed Jan 2, 2024
1 parent 05bf9a9 commit c03991e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/unit-test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ resource "aws_cloudwatch_event_target" "instance_scheduler_weekly_start_in_the_m
)
}

resource "aws_cloudwatch_log_group" "fake" {
name = "Lambda/Fake"
}

#tfsec:ignore:aws-iam-no-policy-wildcards
data "aws_iam_policy_document" "instance-scheduler-lambda-function-policy" {
# checkov:skip=CKV_AWS_107: "Limiting required permissions"
Expand All @@ -73,10 +77,11 @@ data "aws_iam_policy_document" "instance-scheduler-lambda-function-policy" {
actions = [
"logs:CreateLogGroup"
]
resources = [
# consider log group rename to function name or build log group as a separate resource
format("arn:aws:logs:eu-west-2:%s:aws/lambda/fake", data.aws_caller_identity.current.account_id)
]
# resources = [
# # consider log group rename to function name or build log group as a separate resource
# format("arn:aws:logs:eu-west-2:%s:aws/lambda/fake", data.aws_caller_identity.current.account_id)
# ]
resources = aws_cloudwatch_log_group.fake.arn
}
statement {
sid = "AllowLambdaToWriteLogsToGroup"
Expand Down

0 comments on commit c03991e

Please sign in to comment.