Skip to content

Instantly share code, notes, and snippets.

@santiagopoli
Last active March 19, 2018 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santiagopoli/4f9f3d56fffa05df863cdf49392bd56b to your computer and use it in GitHub Desktop.
Save santiagopoli/4f9f3d56fffa05df863cdf49392bd56b to your computer and use it in GitHub Desktop.
Terraform Blue Green / Load Balancers
resource "aws_elb" "terraform-blue-green" {
name = "terraform-blue-green-v${var.infrastructure_version}"
subnets = ["${aws_subnet.terraform-blue-green.*.id}"]
security_groups = ["${aws_security_group.terraform-blue-green.id}"]
instances = ["${aws_instance.terraform-blue-green.*.id}"]
listener {
instance_port = 80
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 3
target = "HTTP:80/"
interval = 30
}
tags {
Name = "terraform-blue-green-v${var.infrastructure_version}"
}
}
output "load_balancer_dns" {
value = "${aws_elb.terraform-blue-green.dns_name}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment