From 15811cf1f8b1018daf083cc405b0e29ec701e6e2 Mon Sep 17 00:00:00 2001 From: AngeloChecked Date: Sat, 5 Oct 2024 20:55:10 +0200 Subject: [PATCH] increase img ttl --- terraform/static-site/cloudfront.tf | 2 +- terraform/terraform.tfstate | 14 +++--- terraform/terraform.tfstate.backup | 74 +++++++++++++++++++++-------- 3 files changed, 63 insertions(+), 27 deletions(-) diff --git a/terraform/static-site/cloudfront.tf b/terraform/static-site/cloudfront.tf index 5c39fc7..6b24b27 100644 --- a/terraform/static-site/cloudfront.tf +++ b/terraform/static-site/cloudfront.tf @@ -129,7 +129,7 @@ resource "aws_cloudfront_distribution" "s3_distribution" { } } - min_ttl = 0 + min_ttl = 2592000 default_ttl = 2592000 max_ttl = 31536000 compress = true diff --git a/terraform/terraform.tfstate b/terraform/terraform.tfstate index 4e3c7fb..f8a626f 100644 --- a/terraform/terraform.tfstate +++ b/terraform/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.6.6", - "serial": 196, + "serial": 198, "lineage": "d903686c-b104-5be0-bf33-d6e6715f3db6", "outputs": {}, "resources": [ @@ -217,13 +217,13 @@ "default_root_object": "index.html", "domain_name": "dssqkj1981x2t.cloudfront.net", "enabled": true, - "etag": "E2TRFVM48H7U6U", + "etag": "E3DZKDKZT6A9HW", "hosted_zone_id": "Z2FDTNDATAQYW2", "http_version": "http2", "id": "E134JZE6VZJIZM", "in_progress_validation_batches": 0, "is_ipv6_enabled": true, - "last_modified_time": "2024-08-25 19:20:46.067 +0000 UTC", + "last_modified_time": "2024-10-05 18:53:16.995 +0000 UTC", "logging_config": [], "ordered_cache_behavior": [ { @@ -300,7 +300,7 @@ "function_association": [], "lambda_function_association": [], "max_ttl": 31536000, - "min_ttl": 0, + "min_ttl": 2592000, "origin_request_policy_id": "", "path_pattern": "/img/*", "realtime_log_config_arn": "", @@ -330,7 +330,7 @@ "cookies": [ { "forward": "none", - "whitelisted_names": null + "whitelisted_names": [] } ], "headers": [], @@ -348,8 +348,8 @@ "response_headers_policy_id": "", "smooth_streaming": false, "target_origin_id": "angeloceccato-website-content", - "trusted_key_groups": null, - "trusted_signers": null, + "trusted_key_groups": [], + "trusted_signers": [], "viewer_protocol_policy": "redirect-to-https" } ], diff --git a/terraform/terraform.tfstate.backup b/terraform/terraform.tfstate.backup index 5bfd005..4e3c7fb 100644 --- a/terraform/terraform.tfstate.backup +++ b/terraform/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.6.6", - "serial": 194, + "serial": 196, "lineage": "d903686c-b104-5be0-bf33-d6e6715f3db6", "outputs": {}, "resources": [ @@ -211,19 +211,19 @@ "target_origin_id": "angeloceccato-website-content", "trusted_key_groups": [], "trusted_signers": [], - "viewer_protocol_policy": "allow-all" + "viewer_protocol_policy": "redirect-to-https" } ], "default_root_object": "index.html", "domain_name": "dssqkj1981x2t.cloudfront.net", "enabled": true, - "etag": "E3042U8TK8QWZQ", + "etag": "E2TRFVM48H7U6U", "hosted_zone_id": "Z2FDTNDATAQYW2", "http_version": "http2", "id": "E134JZE6VZJIZM", "in_progress_validation_batches": 0, "is_ipv6_enabled": true, - "last_modified_time": "2022-06-16 20:52:52.933 +0000 UTC", + "last_modified_time": "2024-08-25 19:20:46.067 +0000 UTC", "logging_config": [], "ordered_cache_behavior": [ { @@ -282,7 +282,7 @@ "HEAD" ], "compress": true, - "default_ttl": 3600, + "default_ttl": 2592000, "field_level_encryption_id": "", "forwarded_values": [ { @@ -299,10 +299,10 @@ ], "function_association": [], "lambda_function_association": [], - "max_ttl": 86400, + "max_ttl": 31536000, "min_ttl": 0, "origin_request_policy_id": "", - "path_pattern": "/docs/*", + "path_pattern": "/img/*", "realtime_log_config_arn": "", "response_headers_policy_id": "", "smooth_streaming": false, @@ -310,6 +310,47 @@ "trusted_key_groups": [], "trusted_signers": [], "viewer_protocol_policy": "redirect-to-https" + }, + { + "allowed_methods": [ + "GET", + "HEAD", + "OPTIONS" + ], + "cache_policy_id": "", + "cached_methods": [ + "GET", + "HEAD" + ], + "compress": true, + "default_ttl": 2592000, + "field_level_encryption_id": "", + "forwarded_values": [ + { + "cookies": [ + { + "forward": "none", + "whitelisted_names": null + } + ], + "headers": [], + "query_string": false, + "query_string_cache_keys": [] + } + ], + "function_association": [], + "lambda_function_association": [], + "max_ttl": 31536000, + "min_ttl": 0, + "origin_request_policy_id": "", + "path_pattern": "/styles.css", + "realtime_log_config_arn": "", + "response_headers_policy_id": "", + "smooth_streaming": false, + "target_origin_id": "angeloceccato-website-content", + "trusted_key_groups": null, + "trusted_signers": null, + "viewer_protocol_policy": "redirect-to-https" } ], "origin": [ @@ -382,7 +423,8 @@ "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", "dependencies": [ "module.website.aws_acm_certificate.default", - "module.website.aws_s3_bucket.website_bucket" + "module.website.aws_s3_bucket.website_bucket", + "module.website.aws_s3_bucket_website_configuration.bucket_configuration" ] } ] @@ -582,7 +624,8 @@ "module.website.aws_acm_certificate.default", "module.website.aws_cloudfront_distribution.s3_distribution", "module.website.aws_route53_zone.primary", - "module.website.aws_s3_bucket.website_bucket" + "module.website.aws_s3_bucket.website_bucket", + "module.website.aws_s3_bucket_website_configuration.bucket_configuration" ] } ] @@ -626,7 +669,8 @@ "module.website.aws_acm_certificate.default", "module.website.aws_cloudfront_distribution.s3_distribution", "module.website.aws_route53_zone.secondary", - "module.website.aws_s3_bucket.website_bucket" + "module.website.aws_s3_bucket.website_bucket", + "module.website.aws_s3_bucket_website_configuration.bucket_configuration" ] } ] @@ -715,14 +759,6 @@ "cors_rule": [], "force_destroy": true, "grant": [ - { - "id": "c4c1ede66af53448b93c283ce9448c4ba468c9432aa01d700d3878632f77d2d0", - "permissions": [ - "FULL_CONTROL" - ], - "type": "CanonicalUser", - "uri": "" - }, { "id": "e17ee8fe9e83a04c358b26883da34dde008fd334d382adcd883056564b8077ab", "permissions": [ @@ -840,7 +876,7 @@ "attributes": { "bucket": "angeloceccato-website-content", "id": "angeloceccato-website-content", - "policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Allow\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::angeloceccato-website-content/*\",\n \"Principal\": {\n \"AWS\": \"*\"\n }\n }\n ]\n}" + "policy": "{\"Statement\":[{\"Action\":\"s3:GetObject\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Resource\":\"arn:aws:s3:::angeloceccato-website-content/*\",\"Sid\":\"\"}],\"Version\":\"2012-10-17\"}" }, "sensitive_attributes": [], "private": "bnVsbA==",