security-groups.tf 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # Several of these security groups will have customer IPs listed in them to allow
  2. # POP systems to access our services.
  3. #
  4. locals {
  5. # Qualys known CIDRs for scanners to call back to home
  6. # (in lieu of using the proxy at least for now)
  7. qualys_mgmt_cidrs = [
  8. "64.39.96.0/24"
  9. ]
  10. }
  11. module "aws_endpoints_sg" {
  12. use_name_prefix = false
  13. source = "terraform-aws-modules/security-group/aws"
  14. version = "~> 3"
  15. name = "aws_endpoints"
  16. tags = merge(var.standard_tags, var.tags)
  17. vpc_id = module.vpc.vpc_id
  18. ingress_cidr_blocks = [ module.vpc.vpc_cidr_block ]
  19. egress_cidr_blocks = [ module.vpc.vpc_cidr_block ]
  20. egress_ipv6_cidr_blocks = [ ]
  21. egress_rules = [ "all-all" ]
  22. ingress_rules = [ "all-all" ]
  23. }
  24. module "allow_all_sg" {
  25. use_name_prefix = false
  26. source = "terraform-aws-modules/security-group/aws"
  27. version = "~> 3"
  28. name = "allow-all"
  29. tags = merge(var.standard_tags, var.tags)
  30. vpc_id = module.vpc.vpc_id
  31. ingress_cidr_blocks = [ "0.0.0.0/0" ]
  32. egress_cidr_blocks = [ "0.0.0.0/0" ]
  33. ingress_rules = [ "all-all" ]
  34. egress_rules = [ "all-all" ]
  35. }
  36. module "allow_all_outbound_sg" {
  37. use_name_prefix = false
  38. source = "terraform-aws-modules/security-group/aws"
  39. version = "~> 3"
  40. name = "allow-all-outbound"
  41. tags = merge(var.standard_tags, var.tags)
  42. vpc_id = module.vpc.vpc_id
  43. egress_rules = [ "all-all" ]
  44. }
  45. module "qualys_scanner_sg" {
  46. use_name_prefix = false
  47. source = "terraform-aws-modules/security-group/aws"
  48. version = "~> 3"
  49. name = "qualys-scanner"
  50. tags = merge(var.standard_tags, var.tags)
  51. vpc_id = module.vpc.vpc_id
  52. egress_with_cidr_blocks = [
  53. {
  54. from_port = 443
  55. to_port = 443
  56. protocol = "TCP"
  57. description = "Qualys Management Plane"
  58. cidr_blocks = join(",",local.qualys_mgmt_cidrs)
  59. },
  60. {
  61. from_port = -1
  62. to_port = -1
  63. protocol = "ALL"
  64. description = "Outbound for scanning things"
  65. cidr_blocks = "10.0.0.0/8"
  66. }
  67. ]
  68. ingress_with_cidr_blocks = [
  69. {
  70. from_port = -1
  71. to_port = -1
  72. protocol = "ICMP"
  73. description = "Permit all ICMP"
  74. cidr_blocks = "10.0.0.0/8"
  75. }
  76. ]
  77. }