-
-
Notifications
You must be signed in to change notification settings - Fork 253
feat(origins): added optional origin_shield section for additional origins #345
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -570,6 +570,14 @@ resource "aws_cloudfront_distribution" "default" { | |
| origin_keepalive_timeout = lookup(origin.value.custom_origin_config, "origin_keepalive_timeout", 60) | ||
| origin_read_timeout = lookup(origin.value.custom_origin_config, "origin_read_timeout", 60) | ||
| } | ||
|
|
||
| dynamic "origin_shield" { | ||
| for_each = origin.value.origin_shield != null ? [origin.value.origin_shield] : [] | ||
| content { | ||
| enabled = origin_shield.value.enabled | ||
| origin_shield_region = origin_shield.value.region | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -589,6 +597,14 @@ resource "aws_cloudfront_distribution" "default" { | |
| origin_access_identity = local.origin_access_identity_enabled && try(length(origin.value.s3_origin_config.origin_access_identity), 0) > 0 ? origin.value.s3_origin_config.origin_access_identity : local.origin_access_identity_enabled ? local.cf_access.path : "" | ||
| } | ||
| } | ||
|
|
||
| dynamic "origin_shield" { | ||
| for_each = origin.value.origin_shield != null ? [origin.value.origin_shield] : [] | ||
| content { | ||
| enabled = origin_shield.value.enabled | ||
| origin_shield_region = origin_shield.value.region | ||
| } | ||
| } | ||
|
Comment on lines
+601
to
+607
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Apply region fallback and filter disabled shields for S3 origins. -for_each = origin.value.origin_shield != null ? [origin.value.origin_shield] : []
+for_each = origin.value.origin_shield.enabled ? [origin.value.origin_shield] : []
content {
enabled = origin_shield.value.enabled
- origin_shield_region = origin_shield.value.region
+ origin_shield_region = coalesce(origin_shield.value.region, local.origin_shield_region)
}
🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -464,6 +464,10 @@ variable "custom_origins" { | |
| origin_keepalive_timeout = number | ||
| origin_read_timeout = number | ||
| }) | ||
| origin_shield = optional(object({ | ||
| enabled = optional(bool, false) | ||
| region = optional(string, null) | ||
| }), null) | ||
| })) | ||
| default = [] | ||
| description = <<-EOT | ||
|
|
@@ -482,6 +486,10 @@ variable "s3_origins" { | |
| s3_origin_config = object({ | ||
| origin_access_identity = string | ||
| }) | ||
| origin_shield = optional(object({ | ||
| enabled = optional(bool, false) | ||
| region = optional(string, null) | ||
| }), null) | ||
| })) | ||
|
Comment on lines
+489
to
493
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add fallback for unset 🤖 Prompt for AI Agents |
||
| default = [] | ||
| description = <<-EOT | ||
|
|
||
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.
🛠️ Refactor suggestion
Apply region fallback and filter disabled shields for custom origins.
Only include the block when
enabledis true and coalesce a nullregiontolocal.origin_shield_region:🤖 Prompt for AI Agents