Repository navigation
Let cloudfront_intercode distributions share their cache and origin request policies - #12488
Merged
Merged
Conversation
…equest policies An AWS account holds at most 20 cache policies, and every cloudfront_intercode distribution created 5 of its own (plus 2 origin request policies). They don't depend on the distribution, so the account was at 20 of 20 with three distributions, and the next convention moved behind CloudFront would have failed to apply. Move the policies into a new cloudfront_intercode_policies module. The distribution module takes an optional shared_policies input; without it, it creates its own set through the same module, so existing users are unaffected (moved blocks keep their state). A shared set can also give the static shell a longer maximum TTL than its default TTL (static_shell_max_ttl), which CloudFront needs for a stale-while-revalidate window longer than the TTL. Checked with a plan against the production state: the refactor alone changes nothing, and adopting one distribution's policies as the shared set renames them in place, updates the other distributions in place and destroys their duplicates, with no replacements. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UKBUsvfbUjKBu9d6FJoEuJ
Contributor
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is |
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.
Why
An AWS account can hold at most 20 CloudFront cache policies, and each
cloudfront_intercodedistribution created 5 of its own (plus 2 origin request policies). The NEIL account is at 20 of 20 with three distributions (i,pand the framework-shell test one), so the next convention moved behind CloudFront would fail to apply. Within one account the policies are identical across distributions, so this is waste, not a need.What
cloudfront_intercode_policiesmodule: the 5 cache policies and 2 origin request policies, moved out ofcloudfront_intercodeunchanged, withcache_policy_idsandorigin_request_policy_idsoutputs.cloudfront_intercodetakes an optionalshared_policiesinput. Without it, it creates its own set through the new module, so existing users don't have to change anything;movedblocks carry their state across.static_shell_max_ttlon the new module (default: the same asstatic_shell_ttl, so no change). CloudFront caps a stale-while-revalidate window at the policy's maximum TTL, so a longer window needs this raised. Not used yet.Checked
tofu validateon both modules; Prettier on the README and workflow.tofu planagainst the production state with neil-terraform pointed at this branch:Not checked
🤖 Generated with Claude Code
https://claude.ai/code/session_01UKBUsvfbUjKBu9d6FJoEuJ