Skip to content

Commit 5cdc9d2

Browse files
committed
Apply to all behaviors
1 parent dd029d0 commit 5cdc9d2

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

infrastructure/cloudfront.tf

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ module "cloudfront_firewall_waf_v2" {
2222
}
2323

2424
resource "aws_cloudfront_distribution" "s3_presign_mask" {
25-
price_class = "PriceClass_100"
26-
25+
price_class = "PriceClass_100"
2726
aliases = [local.cloudfront_full_domain_name]
2827
wait_for_deployment = false
28+
2929
origin {
3030
domain_name = module.ndr-lloyd-george-store.bucket_regional_domain_name
3131
origin_id = module.ndr-lloyd-george-store.bucket_id
3232
origin_access_control_id = aws_cloudfront_origin_access_control.s3.id
3333
}
34+
3435
enabled = true
3536
is_ipv6_enabled = true
3637

@@ -43,6 +44,7 @@ resource "aws_cloudfront_distribution" "s3_presign_mask" {
4344
origin_request_policy_id = local.cloudfront_viewer_policy_id
4445

4546
function_association {
47+
# IF THIS IS EVER COPIED TO A NEW BEHAVIOR, THE FUNCTION MUST BE UPDATED TO ALLOW THE NEW PATH
4648
event_type = "viewer-request"
4749
function_arn = aws_cloudfront_function.block_invalid_urls.arn
4850
}
@@ -68,6 +70,12 @@ resource "aws_cloudfront_distribution" "s3_presign_mask" {
6870
cache_policy_id = local.cloudfront_cache_policy_id
6971
origin_request_policy_id = local.cloudfront_viewer_policy_id
7072

73+
function_association {
74+
# IF THIS IS EVER COPIED TO A NEW BEHAVIOR, THE FUNCTION MUST BE UPDATED TO ALLOW THE NEW PATH
75+
event_type = "viewer-request"
76+
function_arn = aws_cloudfront_function.block_invalid_urls.arn
77+
}
78+
7179
lambda_function_association {
7280
event_type = "origin-request"
7381
lambda_arn = module.edge-presign-lambda.qualified_arn
@@ -89,6 +97,12 @@ resource "aws_cloudfront_distribution" "s3_presign_mask" {
8997
cache_policy_id = local.cloudfront_cache_policy_id
9098
origin_request_policy_id = local.cloudfront_uploader_policy_id
9199

100+
function_association {
101+
# IF THIS IS EVER COPIED TO A NEW BEHAVIOR, THE FUNCTION MUST BE UPDATED TO ALLOW THE NEW PATH
102+
event_type = "viewer-request"
103+
function_arn = aws_cloudfront_function.block_invalid_urls.arn
104+
}
105+
92106
lambda_function_association {
93107
event_type = "origin-request"
94108
lambda_arn = module.edge-presign-lambda.qualified_arn
@@ -107,6 +121,7 @@ resource "aws_cloudfront_distribution" "s3_presign_mask" {
107121
locations = local.allow_us_comms ? ["GB", "US"] : ["GB"]
108122
}
109123
}
124+
110125
web_acl_id = try(module.cloudfront_firewall_waf_v2[0].arn, "")
111126

112127
depends_on = [aws_acm_certificate_validation.cloudfront]

0 commit comments

Comments
 (0)