Skip to content

This terraform modules provides creates needed to invoke a lambda function on s3 bucket notification events

License

Notifications You must be signed in to change notification settings

infraspecdev/terraform-aws-lambda-s3-notification

Repository files navigation

terraform-aws-lambda-s3-notification

This terraform modules provides creates needed to invoke a lambda function on s3 bucket notification events.

Requirements

Name Version
terraform >= 1.2.0
aws ~> 4.16

Providers

Name Version
aws ~> 4.16

Modules

No modules.

Resources

Name Type
aws_cloudwatch_log_group.lambda_s3 resource
aws_iam_role.iam_for_lambda resource
aws_iam_role_policy.logs resource
aws_iam_role_policy_attachment.lambda_policy resource
aws_lambda_function.lambda_s3 resource
aws_lambda_function_event_invoke_config.lambda_s3_invoke_config resource
aws_lambda_permission.allow_s3_invoke_lambda resource
aws_s3_bucket_notification.push_to_lambda resource
aws_region.current data source

Inputs

Name Description Type Default Required
bucket_filter_prefix Optional prefix to limit the notifications to objects with keys that start with matching characters string "" no
bucket_filter_suffix Optional suffix to limit the notifications to objects with keys that end with matching characters string "" no
bucket_names List of S3 bucket names to create Event Notifications for. list(string) n/a yes
directory_path The path to the directory containing the zip file that will be executed by lambda. Defaults to current directory. string "." no
env_vars A map of env vars to be passed to lambda function map(string) {} no
environment This is the environment in which the load balancer will be running string n/a yes
file_name This is the name of the zip file that contains binary to be executed by the lambda string n/a yes
lambda_execution_policy_arn 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 string "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" no
lambda_timeout Amount of time your Lambda Function has to run in seconds number 120 no

Outputs

Name Description
aws_iam_role_arn The ARN of the IAM Role created for the lambda function
aws_lambda_function_arn The ARN of the Lambda Function created

Pre-requisite for PR

Set up pre-commit

brew install pre-commit
brew install terraform-docs
brew install tflint

pre-commit install

#to run hooks against all files for first time after setup
pre-commit run --all-files

TF docs will be populated as part of pre-commit hook, you would need to commit the changes.

For further information on pre-commit, visit this. For further information on pre-commit-terraform, visit this.

About

This terraform modules provides creates needed to invoke a lambda function on s3 bucket notification events

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages