waf.tf 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. module "waf" {
  2. source = "../../../submodules/wafv2"
  3. # Custom to resource
  4. allowed_ips = [ ] # bypasses filters, so should not be needed/used unless warranted
  5. additional_blocked_ips = [ ] # NOTE: There is a standard list in the submodule
  6. resource_arn = aws_alb.jira_server_external.arn
  7. fqdns = concat( # first entry in list will be the WAF name
  8. keys(module.public_dns_record.forward),
  9. # example, to add additional valid hostnames
  10. # keys(module.public_dns_record_cust-auth-elb.forward),
  11. )
  12. excluded_rules_AWSManagedRulesSQLiRuleSet = [
  13. "SQLi_QUERYARGUMENTS",
  14. "SQLi_BODY"
  15. ]
  16. excluded_rules_AWSManagedRulesUnixRuleSet = [
  17. "UNIXShellCommandsVariables_BODY"
  18. ]
  19. # These are passed through and should be the same for module
  20. tags = merge(var.standard_tags, var.tags)
  21. aws_partition = var.aws_partition
  22. aws_region = var.aws_region
  23. aws_account_id = var.aws_account_id
  24. }
  25. # Example: If you want to attach the WAF to an additional ALB
  26. #
  27. # Share a WAF for both services, should be cheaper due to scale, but can be easily separated out
  28. # using the commented section below, if the need arises.
  29. #resource "aws_wafv2_web_acl_association" "associate-auth-to-waf" {
  30. # resource_arn = aws_lb.searchhead-auth-alb.arn
  31. # web_acl_arn = module.waf.web_acl_id
  32. #}
  33. # Example: If you want a second WAF, that should be straightforward
  34. #module "waf-auth" {
  35. # source = "../../../submodules/wafv2"
  36. #
  37. # # Custom to resource
  38. # allowed_ips = [ ] # bypasses filters, so should not be needed/used unless warranted
  39. # additional_blocked_ips = [ ] # NOTE: There is a standard list in the submodule
  40. # resource_arn = aws_lb.searchhead-auth-alb.arn
  41. # fqdns = keys(module.public_dns_record_cust-auth-elb.forward) # first entry in list will be the WAF name
  42. #
  43. # # These are passed through and should be the same for module
  44. # tags = merge(var.standard_tags, var.tags)
  45. # aws_partition = var.aws_partition
  46. # aws_region = var.aws_region
  47. # aws_account_id = var.aws_account_id
  48. #}