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
3 changes: 2 additions & 1 deletion lambda_function/lambda_function.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ locals {
}

resource "aws_cloudwatch_log_group" "lambda_log_group" {
count = var.manage_log_group ? 1 : 0
name = local.log_group_name
retention_in_days = var.log_retention_in_days
tags = var.log_tags == {} ? var.tags : var.log_tags
Expand All @@ -12,7 +13,7 @@ resource "aws_cloudwatch_log_group" "lambda_log_group" {
resource "aws_cloudwatch_log_subscription_filter" "example_subscription_filter" {
count = var.ship_logs_to_sumo ? 1 : 0
name = coalesce(var.subscription_filter_name, "${var.function_name}_subscription_filter")
log_group_name = aws_cloudwatch_log_group.lambda_log_group.name
log_group_name = var.manage_log_group ? aws_cloudwatch_log_group.lambda_log_group[0].name : local.log_group_name
destination_arn = "arn:aws:lambda:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:function:SumoCWLogsLambda"
filter_pattern = ""
}
Expand Down
5 changes: 5 additions & 0 deletions lambda_function/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,8 @@ variable "log_tags" {
default = {}
description = "Tags to apply to the log group. Defaults to the same tags as the lambda function if nothing is passed in."
}

variable "manage_log_group" {
type = bool
default = true
}