security-group-elb-pvt.tf 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #----------------------------------------------------------------------------
  2. # Security Group for HEC ELB
  3. #----------------------------------------------------------------------------
  4. resource "aws_security_group" "hec_pvt_elb_security_group" {
  5. # checkov:skip=CKV2_AWS_5: this SG is attached to HEC
  6. count = local.splunk_private_hec ? 1 : 0
  7. name = "hec_pvt_elb_security_group"
  8. description = "Security Group for the private moose HEC ELBs"
  9. vpc_id = var.vpc_id
  10. tags = merge(local.standard_tags, var.tags, { "Name" = "hec_pvt_elb_security_group" })
  11. }
  12. #----------------------------------------------------------------------------
  13. # INGRESS
  14. #----------------------------------------------------------------------------
  15. resource "aws_security_group_rule" "hec-pvt-https-in-moose" {
  16. count = local.is_moose ? 1 : 0
  17. type = "ingress"
  18. description = "HEC port - HTTPS - Inbound - Moose Only"
  19. from_port = 443
  20. to_port = 443
  21. protocol = "tcp"
  22. cidr_blocks = ["10.0.0.0/8"]
  23. security_group_id = aws_security_group.hec_pvt_elb_security_group[0].id
  24. }
  25. resource "aws_security_group_rule" "hec-pvt-https-in-customer" {
  26. count = local.splunk_private_hec ? 1 : 0
  27. type = "ingress"
  28. description = "HEC port - HTTPS - Inbound - Customer Instances"
  29. from_port = 443
  30. to_port = 443
  31. protocol = "tcp"
  32. cidr_blocks = [var.vpc_cidr]
  33. security_group_id = aws_security_group.hec_pvt_elb_security_group[0].id
  34. }
  35. resource "aws_security_group_rule" "hec-pvt-in-moose" {
  36. count = local.is_moose ? 1 : 0
  37. type = "ingress"
  38. description = "HEC port - Inbound - Moose Only"
  39. from_port = 8088
  40. to_port = 8088
  41. protocol = "tcp"
  42. cidr_blocks = ["10.0.0.0/8"]
  43. security_group_id = aws_security_group.hec_pvt_elb_security_group[0].id
  44. }
  45. resource "aws_security_group_rule" "hec-pvt-in-customer" {
  46. count = local.splunk_private_hec ? 1 : 0
  47. type = "ingress"
  48. description = "HEC port - Inbound - Customer Instances"
  49. from_port = 8088
  50. to_port = 8088
  51. protocol = "tcp"
  52. cidr_blocks = [var.vpc_cidr]
  53. security_group_id = aws_security_group.hec_pvt_elb_security_group[0].id
  54. }
  55. #----------------------------------------------------------------------------
  56. # EGRESS
  57. #----------------------------------------------------------------------------
  58. resource "aws_security_group_rule" "hec-pvt-out" {
  59. count = local.splunk_private_hec ? 1 : 0
  60. type = "egress"
  61. description = "HEC to the indexers"
  62. from_port = 8088
  63. to_port = 8088
  64. protocol = "tcp"
  65. cidr_blocks = local.splunk_vpc_cidrs
  66. security_group_id = aws_security_group.hec_pvt_elb_security_group[0].id
  67. }