You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

  1. resource "aws_security_group" "aws-elb" {
  2. name = "kubernetes-${var.aws_cluster_name}-securitygroup-elb"
  3. vpc_id = "${var.aws_vpc_id}"
  4. tags {
  5. Name = "kubernetes-${var.aws_cluster_name}-securitygroup-elb"
  6. }
  7. }
  8. resource "aws_security_group_rule" "aws-allow-api-access" {
  9. type = "ingress"
  10. from_port = "${var.aws_elb_api_port}"
  11. to_port = "${var.k8s_secure_api_port}"
  12. protocol = "TCP"
  13. cidr_blocks = ["0.0.0.0/0"]
  14. security_group_id = "${aws_security_group.aws-elb.id}"
  15. }
  16. # Create a new AWS ELB for K8S API
  17. resource "aws_elb" "aws-elb-api" {
  18. name = "kubernetes-elb-${var.aws_cluster_name}"
  19. subnets = ["${var.aws_subnet_ids_public}"]
  20. security_groups = ["${aws_security_group.aws-elb.id}"]
  21. listener {
  22. instance_port = "${var.k8s_secure_api_port}"
  23. instance_protocol = "tcp"
  24. lb_port = "${var.aws_elb_api_port}"
  25. lb_protocol = "tcp"
  26. }
  27. health_check {
  28. healthy_threshold = 2
  29. unhealthy_threshold = 2
  30. timeout = 3
  31. target = "HTTP:8080/"
  32. interval = 30
  33. }
  34. cross_zone_load_balancing = true
  35. idle_timeout = 400
  36. connection_draining = true
  37. connection_draining_timeout = 400
  38. tags {
  39. Name = "kubernetes-${var.aws_cluster_name}-elb-api"
  40. }
  41. }