Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. resource "aws_security_group" "dev_jenkins_worker_windows" {
  2. name = "dev_jenkins_worker_windows"
  3. description = "Jenkins Server: created by Terraform for [dev]"
  4.  
  5. # legacy name of VPC ID
  6. vpc_id = "${data.aws_vpc.default_vpc.id}"
  7.  
  8. tags {
  9. Name = "dev_jenkins_worker_windows"
  10. env = "dev"
  11. }
  12. }
  13.  
  14. ###############################################################################
  15. # ALL INBOUND
  16. ###############################################################################
  17.  
  18. # ssh
  19. resource "aws_security_group_rule" "jenkins_worker_windows_from_source_ingress_webui" {
  20. type = "ingress"
  21. from_port = 8080
  22. to_port = 8080
  23. protocol = "tcp"
  24. security_group_id = "${aws_security_group.dev_jenkins_worker_windows.id}"
  25. cidr_blocks = ["0.0.0.0/0"]
  26. description = "ssh to jenkins_worker_windows"
  27. }
  28.  
  29. # rdp
  30. resource "aws_security_group_rule" "jenkins_worker_windows_from_rdp" {
  31. type = "ingress"
  32. from_port = 3389
  33. to_port = 3389
  34. protocol = "tcp"
  35. security_group_id = "${aws_security_group.dev_jenkins_worker_windows.id}"
  36. cidr_blocks = ["<Your Public IP>/32"]
  37. description = "rdp to jenkins_worker_windows"
  38. }
  39.  
  40. ###############################################################################
  41. # ALL OUTBOUND
  42. ###############################################################################
  43.  
  44. resource "aws_security_group_rule" "jenkins_worker_windows_to_all_80" {
  45. type = "egress"
  46. from_port = 80
  47. to_port = 80
  48. protocol = "tcp"
  49. security_group_id = "${aws_security_group.dev_jenkins_worker_windows.id}"
  50. cidr_blocks = ["0.0.0.0/0"]
  51. description = "allow jenkins worker to all 80"
  52. }
  53.  
  54. resource "aws_security_group_rule" "jenkins_worker_windows_to_all_443" {
  55. type = "egress"
  56. from_port = 443
  57. to_port = 443
  58. protocol = "tcp"
  59. security_group_id = "${aws_security_group.dev_jenkins_worker_windows.id}"
  60. cidr_blocks = ["0.0.0.0/0"]
  61. description = "allow jenkins worker to all 443"
  62. }
  63.  
  64. resource "aws_security_group_rule" "jenkins_worker_windows_to_jenkins_server_33453" {
  65. type = "egress"
  66. from_port = 33453
  67. to_port = 33453
  68. protocol = "tcp"
  69. security_group_id = "${aws_security_group.dev_jenkins_worker_windows.id}"
  70. cidr_blocks = ["172.31.0.0/16"]
  71. description = "allow jenkins worker windows to jenkins server"
  72. }
  73.  
  74. resource "aws_security_group_rule" "jenkins_worker_windows_to_jenkins_server_8080" {
  75. type = "egress"
  76. from_port = 8080
  77. to_port = 8080
  78. protocol = "tcp"
  79. security_group_id = "${aws_security_group.dev_jenkins_worker_windows.id}"
  80. source_security_group_id = "${aws_security_group.jenkins_server.id}"
  81. description = "allow jenkins workers windows to jenkins server"
  82. }
  83.  
  84. resource "aws_security_group_rule" "jenkins_worker_windows_to_all_22" {
  85. type = "egress"
  86. from_port = 22
  87. to_port = 22
  88. protocol = "tcp"
  89. security_group_id = "${aws_security_group.dev_jenkins_worker_windows.id}"
  90. cidr_blocks = ["0.0.0.0/0"]
  91. description = "allow jenkins worker windows to connect outbound from 22"
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement