Website hosting doesn't work
alexey-shakura opened this issue · comments
Description
When using output s3_bucket_website_endpoint
from s3 bucket for some reason it's empty although I've enabled website static hosting. I need to use it for cloudfront's origin map.
Versions
-
Module version [Required]:
2.15.0
-
Terraform version:
0.13.6
-
Provider version(s):
registry.terraform.io/hashicorp/aws v3.69.0
registry.terraform.io/hashicorp/random v3.1.2
registry.terraform.io/hashicorp/template v2.2.0
Reproduction Code [Required]
module "ui_app_cdn" {
source = "terraform-aws-modules/cloudfront/aws"
price_class = "PriceClass_100"
wait_for_deployment = true
default_root_object = "index.html"
origin = {
bucket_ui_app_origin = {
domain_name = module.bucket_ui_app.s3_bucket_website_domain
custom_origin_config = {
origin_protocol_policy = "http-only"
http_port = 80
https_port = 0
origin_ssl_protocols = []
}
}
}
custom_error_response = [
{
error_code = 404
error_caching_min_ttl = 0
response_page_path = "/index.html"
response_code = 200
}
]
default_cache_behavior = {
target_origin_id = "bucket_ui_app_origin"
viewer_protocol_policy = "redirect-to-https"
allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD"]
default_ttl = 600
query_string = false
compress = true
response_headers_policy_id = "67f7725c-6f97-4210-82d7-5512b31e9d03"
}
logging_config = {
bucket = module.bucket_ui_app_logs.s3_bucket_bucket_domain_name
prefix = "cloudfront"
include_cookies = true
}
viewer_certificate = {
acm_certificate_arn = aws_acm_certificate.ui_app_cert[0].arn
ssl_support_method = "sni-only"
}
tags = local.tags
}
module "bucket_ui_app" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "~> 2.15.0"
bucket = local.ui_app_bucket
acl = "public-read"
force_destroy = true
versioning = {
enabled = true
}
website = {
index_document = "index.html"
error_document = "index.html"
}
tags = merge(
map("Name", local.ui_app_bucket),
local.tags
)
}
Steps to reproduce the behavior:
Just basic plan command
Expected behavior
I expect to use s3 bucket website static hosting.
Actual behavior
Looks like s3 bucket's hosting isn't even enabled
Terminal Output Screenshot(s)
Consider using s3_bucket_website_endpoint
output instead of s3_bucket_website_domain
, like this:
domain_name = module.bucket_ui_app.s3_bucket_website_endpoint
Please update your code to use v3.0.0 of this module.
https://github.com/terraform-aws-modules/terraform-aws-s3-bucket/blob/master/UPGRADE-3.0.md
@antonbabenko thanks for update 🎉 , will try it out
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.