Skip to content

Commit

Permalink
Merge pull request #21 from dasmeta/DMVP-5181
Browse files Browse the repository at this point in the history
fix(DMVP-5181): Add cors variable for support cors configs
  • Loading branch information
aghamyan44 authored Sep 10, 2024
2 parents c72f03e + ff09dc4 commit 090cf74
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 21 additions & 0 deletions tests/cors-config/1-example.tf
Original file line number Diff line number Diff line change
@@ -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"]
}
]
}
30 changes: 30 additions & 0 deletions tests/cors-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# private

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_private"></a> [private](#module\_private) | ../.. | n/a |
| <a name="module_private-explicitly"></a> [private-explicitly](#module\_private-explicitly) | ../.. | n/a |

## Resources

No resources.

## Inputs

No inputs.

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
}

0 comments on commit 090cf74

Please sign in to comment.