waf.tf 1.8 KB

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