From 54b2e4b246ff4d3eb866c3ffe442911892940217 Mon Sep 17 00:00:00 2001 From: mynampatinaveen Date: Wed, 4 Sep 2024 15:45:40 +0100 Subject: [PATCH] CCL-508 added ListBucket action bucket policy (#168) * CCL-497 added 404 custom_error_response * CCL-508 added ListBucket action bucket policy * CCL-508 added ListBucket action bucket policy * CCL-508 fixed conflicts * CCL-508 fixed conflicts --- modules/products/static-site/cloudfront.tf | 13 +++++++------ modules/products/static-site/storage.tf | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/products/static-site/cloudfront.tf b/modules/products/static-site/cloudfront.tf index 9f44c53..96683ee 100644 --- a/modules/products/static-site/cloudfront.tf +++ b/modules/products/static-site/cloudfront.tf @@ -46,18 +46,19 @@ resource "aws_cloudfront_distribution" "static_site_distribution" { function_association { event_type = "viewer-request" - function_arn = aws_cloudfront_function.rewritedefaultindexrequest.arn + function_arn = aws_cloudfront_function.rewritedefaultindexrequest.arn } + } + custom_error_response { - error_code = 404 - response_page_path = "/404.html" # Path to your custom error page - response_code = 404 + error_code = 404 + response_page_path = "/404.html" # Path to your custom error page + response_code = 404 error_caching_min_ttl = 10 # Cache TTL in seconds - } - } + restrictions { geo_restriction { restriction_type = "none" diff --git a/modules/products/static-site/storage.tf b/modules/products/static-site/storage.tf index 3547bd0..7593502 100644 --- a/modules/products/static-site/storage.tf +++ b/modules/products/static-site/storage.tf @@ -41,7 +41,8 @@ data "aws_iam_policy_document" "static_site_iam_storage_policy_document" { identifiers = ["cloudfront.amazonaws.com"] } actions = [ - "s3:GetObject" + "s3:GetObject", + "s3:ListBucket" ] resources = [ "arn:aws:s3:::${aws_s3_bucket.static_site.id}/*"