refactor(cloudfront): reorganize into atomic submodules under composition/cloudfront-v2 with registry module v6 - #252
Open
itsharshvb wants to merge 3 commits into
Open
Conversation
…tion/cloudfront-v2 with registry module v6
SentinelOne IaC Issues Detector❌ Detected 3 issue(s) in your pull request Here are the detected issues.
SentinelOne CNS is a cloud-agnostic, agentless CSPM & CWPP solution that continuously detects and prevents vulnerabilities that have the highest probability of being exploited in Azure, AWS, Google Cloud, and Kubernetes. |
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
This PR introduces a complete reorganization of CloudFront infrastructure modules, moving from a monolithic v1 approach to atomic submodules under
modules/composition/cloudfront-v2/.Motivation
The existing v1 modules (
cloudfront-distribution,cloudfront-functions,cloudfront-logging,cloudfront-policies,cloudfront-access-control) were tightly coupled standalone modules at themodules/root level. This created:What's Changed
Deleted (v1 cleanup)
modules/cloudfront-distribution/— custom distribution modulemodules/cloudfront-functions/— standalone functions modulemodules/cloudfront-logging/— standalone logging modulemodules/cloudfront-policies/— standalone policies modulemodules/cloudfront-access-control/— standalone access control moduleCreated (v2 atomic submodules)
All relocated under
modules/composition/cloudfront-v2/:access-control/oac/aws_cloudfront_origin_access_controlresourcesaccess-control/oai/aws_cloudfront_origin_access_identityresources (legacy compat)distribution/terraform-aws-modules/cloudfront/aws~> 6.0functions/logging/policies/Key Improvements
Registry module v6: Distribution wrapper uses
terraform-aws-modules/cloudfront/aws ~> 6.0instead of a custom module. This provides:origin_access_controlvariable)Atomic design: No monolithic composition wrapper. Each submodule is independently callable with its own state file, minimizing blast radius.
OAC integration:
origin_access_controlmap for inline OAC creationoac_objectsoutput (full OAC objects with id/arn) for S3 bucket policy consumptionorigin_access_control = "my-oac-key"OAI backward compatibility: Standalone
access-control/oai/submodule retained for existing OAI-based origins.Consistent patterns: Follows
lambda-resourcecomposition precedent — submodules grouped undercomposition/rather than scattered atmodules/root.Breaking Changes
modules/cloudfront-*) are removed. Live layer terragrunt configs must update source paths tomodules/composition/cloudfront-v2/{submodule}.cloudfront_prefix to match registry module v6 convention):cloudfront_distribution_id→distribution_idcloudfront_distribution_arn→distribution_arnaccess-control/oai/or migrate to OAC).Migration Path
Live layer configs should be updated separately: