Skip to content

Commit

Permalink
Use website_endpoint instead of bucket_regional_domain_name (#149)
Browse files Browse the repository at this point in the history
* Update main.tf

* Switch between website and regional

* Auto Format

* Add local.bucket_domain_name

Co-authored-by: cloudpossebot <[email protected]>
  • Loading branch information
nitrocode and cloudpossebot authored Mar 31, 2021
1 parent dd552b3 commit bf9ec67
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ locals {
concat([var.origin_bucket], concat([""], aws_s3_bucket.origin.*.id))
)
)
bucket_domain_name = local.using_existing_origin ? try(data.aws_s3_bucket.selected[0].bucket_regional_domain_name, "") : try(aws_s3_bucket.origin[0].bucket_regional_domain_name, "")

bucket_website_domain_name = local.using_existing_origin ? try(data.aws_s3_bucket.selected[0].website_endpoint, "") : try(aws_s3_bucket.origin[0].website_endpoint, "")
bucket_regional_domain_name = local.using_existing_origin ? try(data.aws_s3_bucket.selected[0].bucket_regional_domain_name, "") : try(aws_s3_bucket.origin[0].bucket_regional_domain_name, "")
bucket_domain_name = var.website_enabled ? local.bucket_website_domain_name : local.bucket_regional_domain_name
}

resource "aws_cloudfront_distribution" "default" {
Expand Down

0 comments on commit bf9ec67

Please sign in to comment.