Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

Commit

Permalink
Add s3 bucket notification
Browse files Browse the repository at this point in the history
This configures PUT events to the s3 bucket to invoke the lambda. NB
this is only supported in terraform v0.6.15
  • Loading branch information
gpeng committed Apr 25, 2016
1 parent 12fef94 commit 6e33128
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions projects/email_alert_notifications/files/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.zip
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,18 @@ resource "null_resource" "build_rename_email_files_with_request_id" {
}
}

resource "aws_lambda_permission" "allow_email_alert_inbox_bucket" {
statement_id = "AllowExecutionFromS3Bucket"
action = "lambda:InvokeFunction"
function_name = "${aws_lambda_function.rename_email_files_with_request_id.arn}"
principal = "s3.amazonaws.com"
source_arn = "${aws_s3_bucket.email_alert_inbox_bucket.arn}"
}

resource "aws_s3_bucket_notification" "email_alert_inbox_bucket_notification" {
bucket = "${aws_s3_bucket.email_alert_inbox_bucket.id}"
lambda_function {
lambda_function_arn = "${aws_lambda_function.rename_email_files_with_request_id.arn}"
events = ["s3:ObjectCreated:Put"]
}
}

0 comments on commit 6e33128

Please sign in to comment.