-
-
Notifications
You must be signed in to change notification settings - Fork 250
Allow using multiple cors origins #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe change removes a dynamic block used for iterating over CORS origins in the S3 bucket configuration and replaces it with a static block. The new configuration directly specifies a sorted list of allowed origins for the CORS rule. The update is applied to the Changes
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
main.tf (1)
357-365
: Simplified CORS configuration with static block and merged origins.
The new implementation consolidates the multiple allowed origins by using a staticcors_rule
block. The expressionallowed_origins = sort( distinct(compact(concat(var.cors_allowed_origins, var.aliases, var.external_aliases))) )ensures that the list of origins is deduplicated, non-null, and sorted deterministically. This is a clear and maintainable solution now that AWS supports multiple origins per CORS rule.
Consider adding an inline comment to document the rationale behind merging these variables for future readers.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
main.tf
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Summary
what
Enable CORS rules to support multiple origins per rule.
why
AWS previously had a bug that restricted each rule to only one
allowed_origin
value. However, it seems this issue has now been fixed, allowing multiple origins per rule.We should consolidate the rules as what we did before and align them with terraform-aws-s3-bucket
references
#22
https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManageCorsUsing.html#cors-allowed-origin