Skip to content

Commit

Permalink
add static page aliases for organizations
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshiel committed Feb 23, 2023
1 parent 1a840b1 commit 9444c67
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ locals {
"*.${var.site_domain_name}"
]
)

static_page_asset_aliases = [var.site_domain_name, "*.${var.site_domain_name}"] # adds support for organizations subdomains
}

###
Expand Down Expand Up @@ -222,7 +224,7 @@ resource "aws_cloudfront_function" "cf_fn_origin_root" {
module "cdn_static_assets" {
source = "git::https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn.git?ref=tags/0.82.4"
acm_certificate_arn = data.aws_acm_certificate.cdn.arn
aliases = [var.site_domain_name]
aliases = local.static_page_asset_aliases
allowed_methods = ["HEAD", "DELETE", "POST", "GET", "OPTIONS", "PUT", "PATCH"]
block_origin_public_access_enabled = true # so only CDN can access it
# having a default cache policy made the apply fail:
Expand Down

0 comments on commit 9444c67

Please sign in to comment.