File tree Expand file tree Collapse file tree 11 files changed +55
-21
lines changed
Expand file tree Collapse file tree 11 files changed +55
-21
lines changed Original file line number Diff line number Diff line change 88
99| Name | Version |
1010| ------| ---------|
11- | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | 5.86.1 |
11+ | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | 5.95.0 |
1212
1313## Modules
1414
3939| <a name =" module_bulk-upload-report-alarm-topic " ></a > [ bulk-upload-report-alarm-topic] ( #module\_ bulk-upload-report-alarm-topic ) | ./modules/sns | n/a |
4040| <a name =" module_bulk-upload-report-lambda " ></a > [ bulk-upload-report-lambda] ( #module\_ bulk-upload-report-lambda ) | ./modules/lambda | n/a |
4141| <a name =" module_bulk_upload_report_dynamodb_table " ></a > [ bulk\_ upload\_ report\_ dynamodb\_ table] ( #module\_ bulk\_ upload\_ report\_ dynamodb\_ table ) | ./modules/dynamo_db | n/a |
42- | <a name =" module_cloudfront-distribution-lg " ></a > [ cloudfront-distribution-lg] ( #module\_ cloudfront-distribution-lg ) | ./modules/cloudfront/ | n/a |
42+ | <a name =" module_cloudfront-distribution-lg " ></a > [ cloudfront-distribution-lg] ( #module\_ cloudfront-distribution-lg ) | ./modules/cloudfront | n/a |
4343| <a name =" module_cloudfront_edge_dynamodb_table " ></a > [ cloudfront\_ edge\_ dynamodb\_ table] ( #module\_ cloudfront\_ edge\_ dynamodb\_ table ) | ./modules/dynamo_db | n/a |
44+ | <a name =" module_cloudfront_firewall_waf_v2 " ></a > [ cloudfront\_ firewall\_ waf\_ v2] ( #module\_ cloudfront\_ firewall\_ waf\_ v2 ) | ./modules/firewall_waf_v2 | n/a |
4445| <a name =" module_create-doc-ref-gateway " ></a > [ create-doc-ref-gateway] ( #module\_ create-doc-ref-gateway ) | ./modules/gateway | n/a |
4546| <a name =" module_create-doc-ref-lambda " ></a > [ create-doc-ref-lambda] ( #module\_ create-doc-ref-lambda ) | ./modules/lambda | n/a |
4647| <a name =" module_create-token-gateway " ></a > [ create-token-gateway] ( #module\_ create-token-gateway ) | ./modules/gateway | n/a |
Original file line number Diff line number Diff line change 1+ module "cloudfront_firewall_waf_v2" {
2+ source = " ./modules/firewall_waf_v2"
3+ cloudfront_acl = true
4+
5+ environment = var. environment
6+ owner = var. owner
7+ count = local. is_sandbox ? 0 : 1
8+ providers = { aws = aws.us_east_1 }
9+ }
10+
111module "cloudfront-distribution-lg" {
2- source = " ./modules/cloudfront/ "
12+ source = " ./modules/cloudfront"
313 bucket_domain_name = " ${ terraform . workspace } -${ var . lloyd_george_bucket_name } .s3.eu-west-2.amazonaws.com"
414 bucket_id = module. ndr-lloyd-george-store . bucket_id
515 qualifed_arn = module. edge-presign-lambda . qualified_arn
616 depends_on = [module . edge-presign-lambda . qualified_arn , module . ndr-lloyd-george-store . bucket_id , module . ndr-lloyd-george-store . bucket_domain_name ]
7- }
17+ web_acl_id = try (module. cloudfront_firewall_waf_v2 [0 ]. arn , " " )
18+ }
Original file line number Diff line number Diff line change 11module "firewall_waf_v2" {
2- source = " ./modules/firewall_waf_v2"
3- environment = var. environment
4- owner = var. owner
5- count = local. is_sandbox ? 0 : 1
2+ source = " ./modules/firewall_waf_v2"
3+ cloudfront_acl = false
4+ environment = var. environment
5+ owner = var. owner
6+ count = local. is_sandbox ? 0 : 1
67}
78
89resource "aws_wafv2_web_acl_association" "web_acl_association" {
@@ -13,4 +14,5 @@ resource "aws_wafv2_web_acl_association" "web_acl_association" {
1314 module . ndr-ecs-fargate-app ,
1415 module . firewall_waf_v2 [0 ]
1516 ]
16- }
17+ }
18+
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ No requirements.
66
77| Name | Version |
88| ------| ---------|
9- | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | n/a |
9+ | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | 5.96.0 |
1010
1111## Modules
1212
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ No requirements.
66
77| Name | Version |
88| ------| ---------|
9- | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | n/a |
9+ | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | 5.95.0 |
1010
1111## Modules
1212
@@ -28,6 +28,7 @@ No modules.
2828| <a name =" input_bucket_domain_name " ></a > [ bucket\_ domain\_ name] ( #input\_ bucket\_ domain\_ name ) | Domain name to assign CloudFront distribution to | ` string ` | n/a | yes |
2929| <a name =" input_bucket_id " ></a > [ bucket\_ id] ( #input\_ bucket\_ id ) | Bucket ID to assign CloudFront distribution to | ` string ` | n/a | yes |
3030| <a name =" input_qualifed_arn " ></a > [ qualifed\_ arn] ( #input\_ qualifed\_ arn ) | Lambda@Edge function association | ` string ` | n/a | yes |
31+ | <a name =" input_web_acl_id " ></a > [ web\_ acl\_ id] ( #input\_ web\_ acl\_ id ) | Web ACL to associate this Cloudfront distribution with | ` string ` | n/a | yes |
3132
3233## Outputs
3334
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ resource "aws_cloudfront_distribution" "distribution" {
3636 locations = [" GB" ]
3737 }
3838 }
39+ web_acl_id = var. web_acl_id
3940}
4041
4142resource "aws_cloudfront_origin_request_policy" "viewer_policy" {
@@ -90,4 +91,5 @@ resource "aws_cloudfront_cache_policy" "nocache" {
9091 query_string_behavior = " none"
9192 }
9293 }
93- }
94+ }
95+
Original file line number Diff line number Diff line change @@ -11,4 +11,11 @@ variable "bucket_id" {
1111variable "qualifed_arn" {
1212 type = string
1313 description = " Lambda@Edge function association"
14- }
14+ }
15+
16+ variable "web_acl_id" {
17+ type = string
18+ description = " Web ACL to associate this Cloudfront distribution with"
19+ default = " "
20+ }
21+
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ No requirements.
66
77| Name | Version |
88| ------| ---------|
9- | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | n/a |
9+ | <a name =" provider_aws " ></a > [ aws] ( #provider\_ aws ) | 5.95.0 |
1010
1111## Modules
1212
@@ -25,6 +25,7 @@ No modules.
2525
2626| Name | Description | Type | Default | Required |
2727| ------| -------------| ------| ---------| :--------:|
28+ | <a name =" input_cloudfront_acl " ></a > [ cloudfront\_ acl] ( #input\_ cloudfront\_ acl ) | n/a | ` bool ` | n/a | yes |
2829| <a name =" input_environment " ></a > [ environment] ( #input\_ environment ) | n/a | ` string ` | n/a | yes |
2930| <a name =" input_owner " ></a > [ owner] ( #input\_ owner ) | n/a | ` string ` | n/a | yes |
3031
Original file line number Diff line number Diff line change 11resource "aws_wafv2_web_acl" "waf_v2_acl" {
2- name = " ${ terraform . workspace } -fw-waf-v2"
2+ name = " ${ terraform . workspace } -${ var . cloudfront_acl ? " cloudfront " : " " } - fw-waf-v2"
33 description = " A WAF to secure the Repo application."
4- scope = " REGIONAL"
4+ scope = var . cloudfront_acl ? " CLOUDFRONT " : " REGIONAL"
55
66 default_action {
77 allow {}
@@ -50,6 +50,9 @@ resource "aws_wafv2_web_acl" "waf_v2_acl" {
5050 for_each = rule. value [" excluded_rules" ]
5151 content {
5252 name = excluded_rule. value
53+ action_to_use {
54+ allow {}
55+ }
5356 }
5457 }
5558
@@ -97,4 +100,5 @@ resource "aws_wafv2_web_acl" "waf_v2_acl" {
97100 Environment = var.environment
98101 Workspace = terraform.workspace
99102 }
100- }
103+ }
104+
Original file line number Diff line number Diff line change 11resource "aws_wafv2_regex_pattern_set" "large_body_uri" {
22 name = " ${ terraform . workspace } -fw-waf-body-size"
33 description = " A set of regex to allow specific pages to bypass the large body check"
4- scope = " REGIONAL"
4+ scope = var . cloudfront_acl ? " CLOUDFRONT " : " REGIONAL"
55
66 # Allow pages involving images
77 regular_expression {
@@ -24,7 +24,7 @@ resource "aws_wafv2_regex_pattern_set" "large_body_uri" {
2424resource "aws_wafv2_regex_pattern_set" "xss_body_uri" {
2525 name = " ${ terraform . workspace } -fw-waf-body-xss"
2626 description = " A regex to allow specific pages to bypass XSS checks on body"
27- scope = " REGIONAL"
27+ scope = var . cloudfront_acl ? " CLOUDFRONT " : " REGIONAL"
2828
2929 # Allow pages involving images
3030 regular_expression {
@@ -42,7 +42,7 @@ resource "aws_wafv2_regex_pattern_set" "xss_body_uri" {
4242resource "aws_wafv2_regex_pattern_set" "exclude_cms_uri" {
4343 name = " ${ terraform . workspace } -fw-waf-cms-exclude"
4444 description = " A regex to allow CMS calls to bypass firewalls"
45- scope = " REGIONAL"
45+ scope = var . cloudfront_acl ? " CLOUDFRONT " : " REGIONAL"
4646
4747 # Allow pages involving images
4848 regular_expression {
You can’t perform that action at this time.
0 commit comments