feat(requirements/aws): output CloudFront OAC bucket-policy statement - #18
Merged
sebastiancorrea81 merged 2 commits intoSep 8, 2026
Merged
Conversation
The static-files scope validates but never writes the assets-bucket policy that grants CloudFront OAC read access, so it repeatedly went missing after distribution replacements when maintained by hand. Expose the AllowCloudFrontOACRead statement as a JSON output (assets_bucket_arn -> cloudfront_oac_bucket_policy_json) instead of creating an aws_s3_bucket_policy resource here, since the assets bucket's policy is already owned by another module and a bucket can only have one such resource. Consumers merge the output into their existing policy document via source_policy_documents. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… data.tf Follow the module's existing convention of grouping data sources in data.tf instead of a dedicated file. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
sebastiancorrea81
deleted the
feat/requirements-aws-cloudfront-oac-policy-output
branch
September 8, 2026 13:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cloudfront/setupvalidates but never writes the assets-bucket policy that grants CloudFront OAC (cloudfront.amazonaws.com) read access — it's a manual, disconnected pre-requisite today, and it has gone missing after CloudFront distribution replacements.requirements/awsnow optionally emits that statement as a ready-to-merge IAM policy document (cloudfront_oac_bucket_policy_json), gated by the newassets_bucket_arninput.aws_s3_bucket_policyresource here: the assets bucket's policy is already owned by another module, and a bucket can only be managed by one such resource. Consumers merge this output into their existing policy document viasource_policy_documents.data.tf, following the module's existing convention.Test plan
tofu fmt -check -diffcleantofu validatepassescloudfront_oac_bucket_policy_jsoninto its existingaws_s3_bucket_policyand confirmscloudfront/setup's bucket-policy check passes on the next deployment🤖 Generated with Claude Code