Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
theseanything committed Jan 27, 2025
1 parent c767a78 commit 8d4808c
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions terraform/deployments/govuk-publishing-infrastructure/wafs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,52 @@ resource "aws_wafv2_web_acl_logging_configuration" "public_bouncer_waf" {
}
}
}

resource "aws_wafv2_web_acl" "cache_public" {
name = "cache_public_web_acl"
scope = "REGIONAL"

default_action {
allow {}
}

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

resource "aws_cloudwatch_log_group" "public_cache_waf" {
# the name must start with aws-waf-logs
# https://docs.aws.amazon.com/waf/latest/developerguide/logging-cw-logs.html#logging-cw-logs-naming
name = "aws-waf-logs-cache-public-${var.govuk_environment}"
retention_in_days = var.waf_log_retention_days
}

resource "aws_wafv2_web_acl_logging_configuration" "public_cache_waf" {
log_destination_configs = [aws_cloudwatch_log_group.public_cache_waf.arn]
resource_arn = aws_wafv2_web_acl.cache_public.arn

logging_filter {
default_behavior = "DROP"

filter {
behavior = "KEEP"

condition {
action_condition {
action = "COUNT"
}
}

condition {
action_condition {
action = "BLOCK"
}
}

requirement = "MEETS_ANY"
}
}
}

0 comments on commit 8d4808c

Please sign in to comment.