diff --git a/s3.tf b/s3.tf
index abe0502..584f512 100644
--- a/s3.tf
+++ b/s3.tf
@@ -1,6 +1,6 @@
module "s3" {
source = "dasmeta/s3/aws"
- version = "1.2.1"
+ version = "1.2.2"
name = var.domain
acl = var.s3_configs.acl
@@ -12,4 +12,5 @@ module "s3" {
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
}
diff --git a/tests/s3-configed/0-setup.tf b/tests/s3-configed/0-setup.tf
new file mode 100644
index 0000000..b2035bf
--- /dev/null
+++ b/tests/s3-configed/0-setup.tf
@@ -0,0 +1,25 @@
+terraform {
+ required_providers {
+ aws = {
+ source = "hashicorp/aws"
+ version = "~> 5.0"
+ }
+ }
+
+ required_version = ">= 1.3.0"
+}
+
+/**
+ * set the following env vars so that aws provider will get authenticated before apply:
+
+ export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxxxxx
+ export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxx
+*/
+provider "aws" {
+ region = "eu-central-1"
+}
+
+provider "aws" {
+ region = "us-east-1"
+ alias = "virginia"
+}
diff --git a/tests/s3-configed/1-example.tf b/tests/s3-configed/1-example.tf
new file mode 100644
index 0000000..c697c0a
--- /dev/null
+++ b/tests/s3-configed/1-example.tf
@@ -0,0 +1,21 @@
+module "this" {
+ source = "../../"
+
+ domain = "basic-test-front-app.devops.dasmeta.com"
+ zone = "devops.dasmeta.com"
+ alternative_domains = ["basic-test-front-app-1.devops.dasmeta.com"]
+ alternative_zones = ["devops.dasmeta.com"]
+
+ s3_configs = {
+ 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"]
+ }
+ ]
+ }
+
+ providers = { aws : aws, aws.virginia : aws.virginia }
+}
diff --git a/tests/s3-configed/README.md b/tests/s3-configed/README.md
new file mode 100644
index 0000000..aa6258a
--- /dev/null
+++ b/tests/s3-configed/README.md
@@ -0,0 +1,32 @@
+# basic
+
+
+## Requirements
+
+| Name | Version |
+|------|---------|
+| [terraform](#requirement\_terraform) | >= 1.3.0 |
+| [aws](#requirement\_aws) | ~> 5.0 |
+
+## Providers
+
+No providers.
+
+## Modules
+
+| Name | Source | Version |
+|------|--------|---------|
+| [this](#module\_this) | ../../ | n/a |
+
+## Resources
+
+No resources.
+
+## Inputs
+
+No inputs.
+
+## Outputs
+
+No outputs.
+
diff --git a/variables.tf b/variables.tf
index 082f1dd..3ea462f 100644
--- a/variables.tf
+++ b/variables.tf
@@ -43,6 +43,7 @@ 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),[])
})
default = {
acl = "private"
@@ -59,6 +60,7 @@ variable "s3_configs" {
error_document = "index.html"
}
create_iam_user = false
+ cors_rule = []
}
description = "S3 bucket configuration options"
}