mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
changed cors definition on s3 bucket
This commit is contained in:
parent
a62c9afa45
commit
8f73cc5f51
3 changed files with 25 additions and 1 deletions
|
|
@ -6,3 +6,10 @@ region = "eu-west-2"
|
||||||
allocated_storage = 20
|
allocated_storage = 20
|
||||||
instance_class = "db.t3.micro"
|
instance_class = "db.t3.micro"
|
||||||
database_name = "DevAssessmentModelDB"
|
database_name = "DevAssessmentModelDB"
|
||||||
|
|
||||||
|
# S3
|
||||||
|
allowed_origins = ["*"]
|
||||||
|
# For prod this should be something like:
|
||||||
|
# allowed_origins = ["https://www.assessment-model.vercel.app"]
|
||||||
|
# or whatever we end up calling the prod site
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,14 @@ resource "aws_s3_bucket" "bucket" {
|
||||||
bucket = "retrofit-plan-inputs-${var.environment}"
|
bucket = "retrofit-plan-inputs-${var.environment}"
|
||||||
acl = "private"
|
acl = "private"
|
||||||
|
|
||||||
|
cors_rule {
|
||||||
|
allowed_headers = ["Content-Type", "Authorization"]
|
||||||
|
allowed_methods = ["PUT"]
|
||||||
|
allowed_origins = var.allowed_origins
|
||||||
|
expose_headers = ["ETag"]
|
||||||
|
max_age_seconds = 3000
|
||||||
|
}
|
||||||
|
|
||||||
server_side_encryption_configuration {
|
server_side_encryption_configuration {
|
||||||
rule {
|
rule {
|
||||||
apply_server_side_encryption_by_default {
|
apply_server_side_encryption_by_default {
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,12 @@ variable "environment" {
|
||||||
description = "The environment for the bucket (dev or prod)"
|
description = "The environment for the bucket (dev or prod)"
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Between production and development, we need to specify the
|
||||||
|
# allowed origins for CORS differently. This variable is set to allow
|
||||||
|
# us to generate pre-signed urls and in development, we want to be able to
|
||||||
|
# do so from localhost.
|
||||||
|
variable "allowed_origins" {
|
||||||
|
description = "Allowed origins for CORS"
|
||||||
|
type = list(string)
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue