Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DMVP-5181): Add sqs event support #7

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions s3.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
module "s3" {
source = "dasmeta/s3/aws"
version = "1.2.2"
version = "1.2.3"

name = var.domain
acl = var.s3_configs.acl
create_index_html = var.s3_configs.create_index_html
ignore_public_acls = var.s3_configs.ignore_public_acls
restrict_public_buckets = var.s3_configs.restrict_public_buckets
block_public_acls = var.s3_configs.block_public_acls
block_public_policy = var.s3_configs.block_public_policy
versioning = var.s3_configs.versioning
website = var.s3_configs.website
create_iam_user = var.s3_configs.create_iam_user
cors_rule = var.s3_configs.cors_rule
name = var.domain
acl = var.s3_configs.acl
create_index_html = var.s3_configs.create_index_html
ignore_public_acls = var.s3_configs.ignore_public_acls
restrict_public_buckets = var.s3_configs.restrict_public_buckets
block_public_acls = var.s3_configs.block_public_acls
block_public_policy = var.s3_configs.block_public_policy
versioning = var.s3_configs.versioning
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
}
10 changes: 8 additions & 2 deletions tests/s3-configed/1-example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ module "this" {
s3_configs = {
cors_rule = [
{
allowed_methods = ["HEAD","GET","PUT", "POST"]
allowed_methods = ["HEAD", "GET", "PUT", "POST"]
allowed_origins = ["https://modules.tf", "https://dasmeta.modules.tf"]
allowed_headers = ["*"]
expose_headers = ["ETag","Access-Control-Allow-Origin"]
expose_headers = ["ETag", "Access-Control-Allow-Origin"]
}
]
event_notification_config = {
target_type = "sqs"
name_suffix = "event"
filter_prefix = "test/"
events = ["s3:ObjectCreated:*"]
}
}

providers = { aws : aws, aws.virginia : aws.virginia }
Expand Down
21 changes: 20 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,21 @@ variable "s3_configs" {
versioning = optional(object({ enabled = bool }), { enabled = false })
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),[])
cors_rule = optional(list(any), [])
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"
name_suffix = "event"
filter_prefix = "test/"
events = ["s3:ObjectCreated:*"]
}
)
})

default = {
acl = "private"
create_index_html = true
Expand All @@ -61,6 +74,12 @@ variable "s3_configs" {
}
create_iam_user = false
cors_rule = []
event-notification-config = {
target_type = "null"
queue_name = "test"
filter_prefix = "test/"
events = ["s3:ObjectCreated:*"]
}
}
description = "S3 bucket configuration options"
}
Expand Down
Loading