diff --git a/modules/s3_bucket_subscription/README.md b/modules/s3_bucket_subscription/README.md
index deb4103..c4d962b 100644
--- a/modules/s3_bucket_subscription/README.md
+++ b/modules/s3_bucket_subscription/README.md
@@ -33,13 +33,13 @@ module "observe_lambda_s3_subscription" {
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.1.0 |
-| [aws](#requirement\_aws) | >= 2.68 |
+| [aws](#requirement\_aws) | >= 4.0 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 2.68 |
+| [aws](#provider\_aws) | >= 4.0 |
## Modules
@@ -60,6 +60,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [bucket\_arns](#input\_bucket\_arns) | S3 bucket ARNs to subscribe to Observe Lambda | `list(string)` | `[]` | no |
+| [enable\_eventbridge](#input\_enable\_eventbridge) | Enable sending bucket notifications to EventBridge | `bool` | `false` | no |
| [filter\_prefix](#input\_filter\_prefix) | Specifies object key name prefix on S3 bucket notifications. | `string` | `""` | no |
| [filter\_suffix](#input\_filter\_suffix) | Specifies object key name suffix on S3 bucket notifications. | `string` | `""` | no |
| [iam\_name\_prefix](#input\_iam\_name\_prefix) | Prefix used for all created IAM roles and policies | `string` | `"observe-lambda-"` | no |
diff --git a/modules/s3_bucket_subscription/main.tf b/modules/s3_bucket_subscription/main.tf
index 26914c9..07344c5 100644
--- a/modules/s3_bucket_subscription/main.tf
+++ b/modules/s3_bucket_subscription/main.tf
@@ -18,8 +18,10 @@ resource "aws_lambda_permission" "allow_bucket" {
}
resource "aws_s3_bucket_notification" "notification" {
- count = length(aws_lambda_permission.allow_bucket)
- bucket = data.aws_arn.bucket[count.index].resource
+ count = length(aws_lambda_permission.allow_bucket)
+ bucket = data.aws_arn.bucket[count.index].resource
+ eventbridge = var.enable_eventbridge
+
lambda_function {
lambda_function_arn = aws_lambda_permission.allow_bucket[count.index].function_name
events = ["s3:ObjectCreated:*"]
diff --git a/modules/s3_bucket_subscription/variables.tf b/modules/s3_bucket_subscription/variables.tf
index c406b9a..b1ca818 100644
--- a/modules/s3_bucket_subscription/variables.tf
+++ b/modules/s3_bucket_subscription/variables.tf
@@ -40,3 +40,10 @@ variable "statement_id_prefix" {
nullable = false
default = ""
}
+
+variable "enable_eventbridge" {
+ description = "Enable sending bucket notifications to EventBridge"
+ type = bool
+ nullable = false
+ default = false
+}
diff --git a/modules/s3_bucket_subscription/versions.tf b/modules/s3_bucket_subscription/versions.tf
index f718a71..859a725 100644
--- a/modules/s3_bucket_subscription/versions.tf
+++ b/modules/s3_bucket_subscription/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 2.68"
+ version = ">= 4.0"
}
}
}