security-group-elb-pvt.tf 2.2 KB

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