Skip to content

Commit

Permalink
Merge pull request #3490 from ministryofjustice/dp-1576-waf
Browse files Browse the repository at this point in the history
Added WAF
  • Loading branch information
murdo-moj authored Sep 27, 2023
2 parents 532cc6f + 6b138ba commit 34f7d7e
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions terraform/environments/data-platform/waf.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
resource "aws_wafv2_web_acl" "waf" {
name = local.environment
scope = "REGIONAL"

default_action {
allow {}
}

rule {
name = "AWS-AWSManagedRulesCommonRuleSet"
priority = 1

override_action {
count {}
}

statement {
managed_rule_group_statement {
name = "AWSManagedRulesCommonRuleSet"
vendor_name = "AWS"
}
}

visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "AWSManagedRulesCommonRuleSet"
sampled_requests_enabled = false
}
}

rule {
name = "AWS-AWSManagedRulesAmazonIpReputationList"
priority = 2

override_action {
count {}
}

statement {
managed_rule_group_statement {
name = "AWSManagedRulesAmazonIpReputationList"
vendor_name = "AWS"
}
}

visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "AWSManagedRulesAmazonIpReputationList"
sampled_requests_enabled = false
}
}


visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "waf"
sampled_requests_enabled = false
}

tags = local.tags
}

resource "aws_wafv2_web_acl_association" "association" {
resource_arn = aws_api_gateway_stage.default_stage.arn
web_acl_arn = aws_wafv2_web_acl.waf.arn
}

0 comments on commit 34f7d7e

Please sign in to comment.