-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
This should be a discussion, but discussions are disabled for this repo, so I made a ticket instead.
I want to enable EventBridge notifications for the buckets I create with your module. The code is very simple:
resource "aws_s3_bucket_notification" "bucket_notification" {
count = local.create_bucket && !var.is_directory_bucket && var.enable_eventbridge_notifications ? 1 : 0
region = var.region
bucket = aws_s3_bucket.this[0].id
eventbridge = var.enable_eventbridge_notifications
}
I saw you have in your examples a few ways to enable other kinds of notifications (to Lambda, etc). All those example require Terraform code external to this module.
But, because of the way I invoke your modules (from Terragrunt), I very much prefer to keep the related code in the same module. In other words, aws_s3_bucket_notification needs to be in this module.
Alternatively, I could create a separate module, just for this feature. But the code is so trivial, it's not worth creating a new module.
Additionally, there can be only one aws_s3_bucket_notification resource for each aws_s3_bucket.
Because of all of the above, it would be great if the terraform-aws-s3-bucket module gained notifications code. I could submit a PR just for EventBridge. I don't have the resources to test the other cases. But keep in mind, there can be only one aws_s3_bucket_notification per bucket.
What's your take on all this?