mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +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
|
|
@ -5,4 +5,11 @@ region = "eu-west-2"
|
|||
# Database
|
||||
allocated_storage = 20
|
||||
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}"
|
||||
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 {
|
||||
rule {
|
||||
apply_server_side_encryption_by_default {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,13 @@
|
|||
variable "environment" {
|
||||
description = "The environment for the bucket (dev or prod)"
|
||||
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