diff --git a/main.tf b/main.tf index 7c36023..aedcd10 100644 --- a/main.tf +++ b/main.tf @@ -17,6 +17,7 @@ module "bucket" { block_public_policy = var.block_public_policy control_object_ownership = var.acl != null ? true : var.control_object_ownership object_ownership = var.object_ownership + cors_rule = var.cors_rule versioning = var.versioning diff --git a/tests/cors-config/1-example.tf b/tests/cors-config/1-example.tf new file mode 100644 index 0000000..1b21efa --- /dev/null +++ b/tests/cors-config/1-example.tf @@ -0,0 +1,21 @@ +module "private" { + source = "../.." + + name = "dasmeta-dev-private" +} + +module "private-explicitly" { + source = "../.." + + name = "dasmeta-dev-private-explicitly" + acl = "private" + + cors_rule = [ + { + allowed_methods = ["HEAD","GET","PUT", "POST"] + allowed_origins = ["https://modules.tf", "https://dasmeta.modules.tf"] + allowed_headers = ["*"] + expose_headers = ["ETag","Access-Control-Allow-Origin"] + } +] +} diff --git a/tests/cors-config/README.md b/tests/cors-config/README.md new file mode 100644 index 0000000..e737c28 --- /dev/null +++ b/tests/cors-config/README.md @@ -0,0 +1,30 @@ +# private + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [private](#module\_private) | ../.. | n/a | +| [private-explicitly](#module\_private-explicitly) | ../.. | n/a | + +## Resources + +No resources. + +## Inputs + +No inputs. + +## Outputs + +No outputs. + diff --git a/variables.tf b/variables.tf index e513b01..0a10351 100644 --- a/variables.tf +++ b/variables.tf @@ -112,3 +112,9 @@ variable "bucket_files" { } description = "Initial content for bucket, use acl and pattern params if you need more control." } + +variable "cors_rule" { + description = "List of maps containing rules for Cross-Origin Resource Sharing." + type = any + default = [] +}