diff --git a/s3.tf b/s3.tf index db190ba..8f8bfcc 100644 --- a/s3.tf +++ b/s3.tf @@ -14,5 +14,5 @@ module "s3" { website = var.s3_configs.website create_iam_user = var.s3_configs.create_iam_user cors_rule = var.s3_configs.cors_rule - event-notification-config = var.s3_configs.event-notification-config + event_notification_config = var.s3_configs.event_notification_config } diff --git a/tests/s3-configed/1-example.tf b/tests/s3-configed/1-example.tf index 07173c2..391b613 100644 --- a/tests/s3-configed/1-example.tf +++ b/tests/s3-configed/1-example.tf @@ -15,9 +15,9 @@ module "this" { expose_headers = ["ETag", "Access-Control-Allow-Origin"] } ] - event-notification-config = { + event_notification_config = { target_type = "sqs" - queue_name = "test" + name_suffix = "event" filter_prefix = "test/" events = ["s3:ObjectCreated:*"] } diff --git a/variables.tf b/variables.tf index 0076cad..4e77ac4 100644 --- a/variables.tf +++ b/variables.tf @@ -44,19 +44,20 @@ variable "s3_configs" { website = optional(object({ index_document = string, error_document = string }), { index_document = "index.html", error_document = "index.html" }) create_iam_user = optional(bool, false) cors_rule = optional(list(any), []) - event-notification-config = optional(object({ - target_type = string, - queue_name = string, - filter_prefix = string, - events = optional(list(string), ["s3:ObjectCreated:*"]) + event_notification_config = optional(object({ + target_type = string, // Target type for the S3 event notification, can be "sqs" or "null". Other target types can be implemented in the future. + name_suffix = string, // Suffix to add to the target name. + filter_prefix = string, // Prefix to filter object key names for the event notification. + events = optional(list(string), ["s3:ObjectCreated:*"]) // List of S3 events that trigger the notification. Defaults to "s3:ObjectCreated:*". }), { target_type = "null" - queue_name = "test" + name_suffix = "event" filter_prefix = "test/" events = ["s3:ObjectCreated:*"] } ) }) + default = { acl = "private" create_index_html = true