-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MLPAB-1507 - Fix issue creating bucket notification links (#794)
* remove notifications from av (only one resource per bucket) * output functions for use in bucket module * add permissions to lambdas for s3 bucket * remove duplicated permissions
- Loading branch information
1 parent
b372564
commit 65c5b86
Showing
8 changed files
with
60 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "lambda_function" { | ||
value = aws_lambda_function.lambda_function | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
terraform/environment/region/modules/uploads_s3_bucket/s3_notifications.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
resource "aws_s3_bucket_notification" "bucket_notification" { | ||
bucket = aws_s3_bucket.bucket.id | ||
|
||
lambda_function { | ||
id = "bucket-av-scan" | ||
lambda_function_arn = var.s3_antivirus_lambda_function.arn | ||
events = ["s3:ObjectCreated:Put"] | ||
} | ||
|
||
lambda_function { | ||
id = "av-object-tagging" | ||
lambda_function_arn = var.events_received_lambda_function.arn | ||
events = ["s3:ObjectTagging:Put"] | ||
} | ||
depends_on = [aws_lambda_permission.av_scan, aws_lambda_permission.object_tagging] | ||
provider = aws.region | ||
} | ||
|
||
resource "aws_lambda_permission" "av_scan" { | ||
statement_id = "AllowExecutionFromS3BucketAvScan" | ||
action = "lambda:InvokeFunction" | ||
function_name = var.s3_antivirus_lambda_function.function_name | ||
principal = "s3.amazonaws.com" | ||
source_account = data.aws_caller_identity.current.account_id | ||
source_arn = aws_s3_bucket.bucket.arn | ||
provider = aws.region | ||
} | ||
|
||
resource "aws_lambda_permission" "object_tagging" { | ||
statement_id = "AllowExecutionFromS3BucketObjectTagging" | ||
action = "lambda:InvokeFunction" | ||
function_name = var.events_received_lambda_function.function_name | ||
principal = "s3.amazonaws.com" | ||
source_account = data.aws_caller_identity.current.account_id | ||
source_arn = aws_s3_bucket.bucket.arn | ||
provider = aws.region | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters