security-groups.tf 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # From vmray admin installation guide, page 24
  2. # Clients to server on 443
  3. # Server to workers on 5900-5999 (VNC)
  4. # Workers to server on 80 and 443
  5. # Server
  6. resource "aws_security_group" "vmray_server_sg" {
  7. name = "vmray_server_sg"
  8. description = "Security Rules Specific to VMRay"
  9. vpc_id = var.vpc_id
  10. tags = merge(var.standard_tags, var.tags)
  11. }
  12. resource "aws_security_group_rule" "vmray_server_https_in" {
  13. type = "ingress"
  14. from_port = 443
  15. to_port = 443
  16. protocol = "tcp"
  17. cidr_blocks = var.cidr_map["vpc-access"]
  18. security_group_id = aws_security_group.vmray_server_sg.id
  19. }
  20. ## Proxy - Ubuntu Advantage doesn't appear to respect it
  21. #resource "aws_security_group_rule" "vmray_server_http_out" {
  22. # type = "egress"
  23. # from_port = 80
  24. # to_port = 80
  25. # protocol = "tcp"
  26. # cidr_blocks = [ "0.0.0.0/0" ]
  27. # security_group_id = aws_security_group.vmray_server_sg.id
  28. #}
  29. #
  30. #resource "aws_security_group_rule" "vmray_server_https_out" {
  31. # type = "egress"
  32. # from_port = 443
  33. # to_port = 443
  34. # protocol = "tcp"
  35. # cidr_blocks = [ "0.0.0.0/0" ]
  36. # security_group_id = aws_security_group.vmray_server_sg.id
  37. #}
  38. resource "aws_security_group_rule" "vmray_server_vnc_to_workers" {
  39. type = "egress"
  40. from_port = 5900
  41. to_port = 5999
  42. protocol = "tcp"
  43. source_security_group_id = aws_security_group.vmray_worker_sg.id
  44. security_group_id = aws_security_group.vmray_server_sg.id
  45. }
  46. # Workers
  47. resource "aws_security_group" "vmray_worker_sg" {
  48. name = "vmray_worker_sg"
  49. description = "Security Rules for the VMRay Worker Nodes"
  50. vpc_id = var.vpc_id
  51. tags = merge(var.standard_tags, var.tags)
  52. }
  53. resource "aws_security_group_rule" "vmwary_worker_vnc_from_server" {
  54. type = "ingress"
  55. from_port = 5900
  56. to_port = 5999
  57. protocol = "tcp"
  58. source_security_group_id = aws_security_group.vmray_server_sg.id
  59. security_group_id = aws_security_group.vmray_worker_sg.id
  60. }
  61. resource "aws_security_group_rule" "vmray_worker_http_out" {
  62. type = "egress"
  63. from_port = 80
  64. to_port = 80
  65. protocol = "tcp"
  66. cidr_blocks = [ "0.0.0.0/0" ]
  67. security_group_id = aws_security_group.vmray_worker_sg.id
  68. }
  69. resource "aws_security_group_rule" "vmray_worker_https_out" {
  70. type = "egress"
  71. from_port = 443
  72. to_port = 443
  73. protocol = "tcp"
  74. cidr_blocks = [ "0.0.0.0/0" ]
  75. security_group_id = aws_security_group.vmray_worker_sg.id
  76. }
  77. resource "aws_security_group_rule" "vmray_worker_http_to_server" {
  78. type = "egress"
  79. from_port = 80
  80. to_port = 80
  81. protocol = "tcp"
  82. source_security_group_id = aws_security_group.vmray_server_sg.id
  83. security_group_id = aws_security_group.vmray_worker_sg.id
  84. }
  85. resource "aws_security_group_rule" "vmray_worker_https_to_server" {
  86. type = "egress"
  87. from_port = 443
  88. to_port = 443
  89. protocol = "tcp"
  90. source_security_group_id = aws_security_group.vmray_server_sg.id
  91. security_group_id = aws_security_group.vmray_worker_sg.id
  92. }