Skip to content

Commit

Permalink
feat: set bucket filter prefix and suffix as input vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinimanoj committed Aug 23, 2022
1 parent e4f061e commit 30fa9fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ resource "aws_s3_bucket_notification" "push_to_lambda" {
lambda_function {
lambda_function_arn = aws_lambda_function.lambda_s3.arn
events = ["s3:ObjectCreated:*"]
filter_prefix = "AWSLogs/"
filter_suffix = ".log.gz"
filter_prefix = var.bucket_filter_prefix
filter_suffix = var.bucket_filter_suffix
}

depends_on = [aws_lambda_permission.allow_s3_invoke_lambda]
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,15 @@ variable "lambda_execution_policy_arn" {
description = "The managed policy arn for lambda, for more info: https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html#permissions-executionrole-features"
default = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}

variable "bucket_filter_prefix" {
type = string
description = "Optional prefix to limit the notifications to objects with keys that start with matching characters"
default = ""
}

variable "bucket_filter_suffix" {
type = string
description = "Optional suffix to limit the notifications to objects with keys that end with matching characters"
default = ""
}

0 comments on commit 30fa9fa

Please sign in to comment.