Skip to content

fix: Work around limit in lambda policy size #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 4 additions & 3 deletions logs_monitoring_cloudwatch_log.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ resource "aws_cloudwatch_log_subscription_filter" "test_lambdafunction_logfilter
distribution = "Random"
}

// we're using wildcard sources instead of making separate grant per source
// in order to avoid hitting limit of 20KB per lambda function's aggregated policy size
resource "aws_lambda_permission" "allow_cloudwatch_logs_to_call_dd_lambda_handler" {
for_each = { for lg in var.cloudwatch_log_groups : lg => lg }
statement_id = "${substr(replace(each.value, "/", "_"), 0, 67)}-AllowExecutionFromCloudWatchLogs"
statement_id = "AllowExecutionFromCloudWatchLogs"
action = "lambda:InvokeFunction"
function_name = aws_cloudformation_stack.datadog-forwarder.outputs.DatadogForwarderArn
principal = "logs.${var.aws_region}.amazonaws.com"
source_arn = "arn:aws:logs:${var.aws_region}:${var.aws_account_id}:log-group:${each.value}:*"
source_arn = "arn:aws:logs:${var.aws_region}:${var.aws_account_id}:log-group:*"
}
Loading