Skip to content

Commit

Permalink
Merge pull request #7 from dasmeta/DMVP-5181
Browse files Browse the repository at this point in the history
  • Loading branch information
aghamyan44 authored Sep 23, 2024
2 parents 1514be6 + 2676280 commit 4e94283
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 15 deletions.
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

0 comments on commit 4e94283

Please sign in to comment.