-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add label_match_statement & rule_labels (#58)
* feat: add label_match_statement As per https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_web_acl\#label_match_statement * feat: add rule_labels option Co-authored-by: Ray Smets <rayjsmets@gmail.com> Co-authored-by: Ray Smets <rayjsmets@gmail.com>
- Loading branch information
1 parent
1d3e1c2
commit 959daf9
Showing
5 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
examples/wafv2-custom-json-response-managed-rule-group/main.tf
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
provider "aws" { | ||
region = "eu-west-1" | ||
} | ||
|
||
module "waf" { | ||
source = "../.." | ||
|
||
name_prefix = var.name_prefix | ||
allow_default_action = true | ||
|
||
create_alb_association = false | ||
|
||
visibility_config = { | ||
cloudwatch_metrics_enabled = false | ||
metric_name = "${var.name_prefix}-waf-setup-waf-main-metrics" | ||
sampled_requests_enabled = false | ||
} | ||
|
||
custom_response_bodies = [ | ||
{ | ||
key = "403-forbidden-json" | ||
content = "{\"code\":403,\"message\":\"Forbidden\"}" | ||
content_type = "APPLICATION_JSON" | ||
} | ||
] | ||
|
||
rules = [ | ||
{ | ||
name = "AWSManagedRulesCommonRuleSet-rule" | ||
priority = "0" | ||
|
||
override_action = "count" | ||
|
||
visibility_config = { | ||
cloudwatch_metrics_enabled = true | ||
metric_name = "AWSManagedRulesCommonRuleSet-metric" | ||
sampled_requests_enabled = true | ||
} | ||
|
||
managed_rule_group_statement = { | ||
name = "AWSManagedRulesCommonRuleSet" | ||
vendor_name = "AWS" | ||
} | ||
}, | ||
{ | ||
name = "JsonResponse" | ||
priority = "1" | ||
action = "block" | ||
custom_response = { | ||
custom_response_body_key = "403-forbidden-json" | ||
response_code = 403 | ||
} | ||
|
||
visibility_config = { | ||
cloudwatch_metrics_enabled = true | ||
metric_name = "AWSManagedRulesCommonRuleSetJsonResponse" | ||
sampled_requests_enabled = true | ||
} | ||
|
||
label_match_statement = { | ||
key = "awswaf:managed:aws:" | ||
scope = "NAMESPACE" | ||
} | ||
}, | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
examples/wafv2-custom-json-response-managed-rule-group/variables.tf
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
variable "name_prefix" { | ||
description = "A prefix used for naming resources." | ||
type = string | ||
default = "example" | ||
} |
This file contains 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
This file contains 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
This file contains 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