Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Dec 13, 2023
1 parent ee0e03b commit bf336df
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 36 deletions.
5 changes: 0 additions & 5 deletions terraform/cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ resource "aws_cloudfront_distribution" "main" {
origin_id = module.s3_public.id
}

origin {
domain_name = module.s3_static.bucket_regional_domain_name
origin_id = module.s3_static.id
}

# Static
ordered_cache_behavior {
path_pattern = "/build/*"
Expand Down
18 changes: 0 additions & 18 deletions terraform/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ data "aws_iam_policy_document" "ecs_task" {
resources = [
module.s3_public.arn,
"${module.s3_public.arn}/*",
module.s3_static.arn,
"${module.s3_static.arn}/*",
module.s3_private.arn,
"${module.s3_private.arn}/*"
]
Expand Down Expand Up @@ -79,23 +77,7 @@ data "aws_iam_policy_document" "s3_cloudfront_public" {
}
}
}
data "aws_iam_policy_document" "s3_cloudfront_static" {
statement {
actions = ["s3:GetObject"]
resources = ["${module.s3_static.arn}/*"]

principals {
type = "Service"
identifiers = ["cloudfront.amazonaws.com"]
}

condition {
test = "StringEquals"
variable = "AWS:SourceArn"
values = [aws_cloudfront_distribution.main.arn]
}
}
}
data "aws_iam_policy_document" "s3_cloudfront_private" {
statement {
actions = ["s3:GetObject"]
Expand Down
18 changes: 5 additions & 13 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ module "ecs_app" {
{
name = "PRELAUNCH_SECRET"
value = var.prelaunch_secret
}
},
{
name = "MAIL_FROM_ADDRESS"
value = "no-reply@${var.domain_name}"
},
]

secrets = [
Expand Down Expand Up @@ -157,18 +161,6 @@ module "ecs_app" {
]
}

module "s3_static" {
source = "./modules/s3"

block_public_acls = false
block_public_policy = false
ignore_public_acls = false
restrict_public_buckets = false

name = "${local.namespace}-static"
policy = data.aws_iam_policy_document.s3_cloudfront_static.json
}

module "s3_public" {
source = "./modules/s3"

Expand Down

0 comments on commit bf336df

Please sign in to comment.