Skip to content

v1.0.1

Choose a tag to compare

@cloudposse-releaser cloudposse-releaser released this 10 Sep 17:44
· 3 commits to main since this release
31cc5d7

🚀 Enhancements

fix: Resolve unsupported attribute error in S3 website block @jwadolowski (#358) ## what

Restore lookup() calls in main.tf to address the website_enabled = true use case that was broken when #340 replaced them with explicit variable calls to avoid silent default value assignments. Additionally includes corresponding module instances in the test suite.

why

website_enabled = true implies a reference to 2 mutually exclusive configurations defined as the local.website_config variable. In the default case, index_document, error_document, and routing_rules elements exist, but redirect_all_requests_to does not, which leads to the following error:

╷
│ Error: Unsupported attribute
│
│   on ../../main.tf line 325, in resource "aws_s3_bucket" "origin":
│  325:       redirect_all_requests_to = website.value.redirect_all_requests_to
│     ├────────────────
│     │ website.value is object with 3 attributes
│
│ This object does not have an attribute named "redirect_all_requests_to".
╵

Similarly, website_enabled = true combined with redirect_all_requests_to = "https://example.com" would result in missing references to the index_document, error_document, and routing_rules fields.

All in all, in this particular case, the lookup() usage is definitely justified and does not mean a silent/hidden injection of a variable default.

references