Skip to content

Commit

Permalink
NCAS: Add WAF Setup (#3959)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-k1998 authored Nov 10, 2023
1 parent 6530c39 commit 2a14db5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
5 changes: 5 additions & 0 deletions terraform/environments/ncas/load_balancer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,8 @@ resource "aws_lb_listener" "ncas_lb" {
target_group_arn = aws_lb_target_group.ncas_target_group.arn
}
}

resource "aws_wafv2_web_acl_association" "web_acl_association_my_lb" {
resource_arn = aws_lb.ncas_lb.arn
web_acl_arn = aws_wafv2_web_acl.ncas_web_acl.arn
}
36 changes: 36 additions & 0 deletions terraform/environments/ncas/waf.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
resource "aws_wafv2_web_acl" "ncas_web_acl" {
name = "ncas-web-acl"
scope = "REGIONAL"

default_action {
allow {}
}

rule {
name = "common-rule-set"
priority = 1

override_action {
none {}
}

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

visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "AWSManagedRulesCommonRuleSetMetrics"
sampled_requests_enabled = true
}
}

visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "ncas-web-acl"
sampled_requests_enabled = true
}
}

0 comments on commit 2a14db5

Please sign in to comment.