elbclassic.tf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #--------------------------------------------------------------
  2. # Internal ELB
  3. #--------------------------------------------------------------
  4. resource "aws_route53_record" "github_internal" {
  5. zone_id = var.dns_info["private"]["zone_id"]
  6. name = "github.${var.dns_info["private"]["zone"]}"
  7. type = "CNAME"
  8. records = [aws_elb.internal.dns_name]
  9. ttl = "60"
  10. provider = aws.c2
  11. }
  12. resource "aws_route53_record" "github_internal_wildcard" {
  13. zone_id = var.dns_info["private"]["zone_id"]
  14. name = "*.github.${var.dns_info["private"]["zone"]}"
  15. type = "CNAME"
  16. records = [aws_elb.internal.dns_name]
  17. ttl = "60"
  18. provider = aws.c2
  19. }
  20. resource "aws_elb" "internal" {
  21. name_prefix = "gheint"
  22. internal = true
  23. subnets = var.private_subnets
  24. security_groups = [aws_security_group.ghe_elb_internal.id]
  25. listener {
  26. instance_port = 443
  27. instance_protocol = "HTTPS"
  28. lb_port = 443
  29. lb_protocol = "HTTPS"
  30. ssl_certificate_id = aws_acm_certificate.cert.arn
  31. }
  32. listener {
  33. instance_port = 8444
  34. instance_protocol = "TCP"
  35. lb_port = 8443
  36. lb_protocol = "TCP"
  37. }
  38. listener {
  39. instance_port = 23
  40. instance_protocol = "TCP"
  41. lb_port = 22
  42. lb_protocol = "TCP"
  43. }
  44. health_check {
  45. healthy_threshold = 2
  46. unhealthy_threshold = 2
  47. timeout = 3
  48. target = "HTTPS:443/status"
  49. interval = 30
  50. }
  51. }
  52. resource "aws_proxy_protocol_policy" "internal_proxy_protocol" {
  53. load_balancer = aws_elb.internal.name
  54. instance_ports = ["23", "444", "8444"]
  55. }
  56. # Create a new load balancer attachment
  57. resource "aws_elb_attachment" "internal_attachment" {
  58. count = var.instance_count
  59. elb = aws_elb.internal.id
  60. instance = aws_instance.ghe[count.index].id
  61. }