security-groups.tf 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. from_port = 443
  69. to_port = 443
  70. protocol = "TCP"
  71. description = "Temp allow all outbound ; remove when proxy in place"
  72. cidr_blocks = "0.0.0.0/0"
  73. }
  74. ]
  75. ingress_with_cidr_blocks = [
  76. {
  77. from_port = -1
  78. to_port = -1
  79. protocol = "ICMP"
  80. description = "Permit all ICMP"
  81. cidr_blocks = "10.0.0.0/8"
  82. }
  83. ]
  84. }