diff --git a/lambda_function/lambda_function.tf b/lambda_function/lambda_function.tf index 87ba273..24222c0 100644 --- a/lambda_function/lambda_function.tf +++ b/lambda_function/lambda_function.tf @@ -11,7 +11,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 = "${var.function_name}_subscription_filter" + name = coalesce(var.subscription_filter_name, "${var.function_name}_subscription_filter") log_group_name = aws_cloudwatch_log_group.lambda_log_group.name destination_arn = "arn:aws:lambda:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:function:SumoCWLogsLambda" filter_pattern = "" diff --git a/lambda_function/variables.tf b/lambda_function/variables.tf index 1373dc3..0159a0a 100644 --- a/lambda_function/variables.tf +++ b/lambda_function/variables.tf @@ -184,6 +184,12 @@ variable "log_skip_destroy" { description = "If true, the log group will not be destroyed when the lambda is destroyed" } +variable "subscription_filter_name" { + type = string + default = null + description = "Optional override for the CloudWatch Logs subscription filter name" +} + variable "ship_logs_to_sumo" { type = bool default = false @@ -194,4 +200,4 @@ variable "log_tags" { type = map(string) default = {} description = "Tags to apply to the log group. Defaults to the same tags as the lambda function if nothing is passed in." -} \ No newline at end of file +}