security.j 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {% import 'variables.include' as var %}
  2. #######
  3. # A security group for the ELB so it is accessible via the web
  4. resource "aws_security_group" "sg_instance_access" {
  5. name = "sg_instance_access"
  6. description = "Allows ssh/http/https in from me. Allows outbound on select ports."
  7. vpc_id = "${aws_vpc.vpc_primary.id}"
  8. # SSH, HTTP, and HTTPS inbound from me
  9. ingress {
  10. from_port = 22
  11. to_port = 22
  12. protocol = "tcp"
  13. cidr_blocks = "${var.Trusted-CIDR}"
  14. }
  15. ingress {
  16. from_port = 80
  17. to_port = 80
  18. protocol = "tcp"
  19. cidr_blocks = "${var.Trusted-CIDR}"
  20. }
  21. ingress {
  22. from_port = 443
  23. to_port = 443
  24. protocol = "tcp"
  25. cidr_blocks = "${var.Trusted-CIDR}"
  26. }
  27. # Outbound Access
  28. egress {
  29. from_port = 20
  30. to_port = 21
  31. protocol = "tcp"
  32. cidr_blocks = ["0.0.0.0/0"]
  33. }
  34. egress {
  35. from_port = 22
  36. to_port = 22
  37. protocol = "tcp"
  38. cidr_blocks = ["0.0.0.0/0"]
  39. }
  40. egress {
  41. from_port = 53
  42. to_port = 53
  43. protocol = "tcp"
  44. cidr_blocks = ["0.0.0.0/0"]
  45. }
  46. egress {
  47. from_port = 53
  48. to_port = 53
  49. protocol = "udp"
  50. cidr_blocks = ["0.0.0.0/0"]
  51. }
  52. egress {
  53. from_port = 80
  54. to_port = 80
  55. protocol = "tcp"
  56. cidr_blocks = ["0.0.0.0/0"]
  57. }
  58. egress {
  59. from_port = 443
  60. to_port = 443
  61. protocol = "tcp"
  62. cidr_blocks = ["0.0.0.0/0"]
  63. }
  64. }