Skip to content

Instantly share code, notes, and snippets.

@elliotforbes
Created July 3, 2018 09:50
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 elliotforbes/ad4bcee03207d6b8ec88fc88a3101c0e to your computer and use it in GitHub Desktop.
Save elliotforbes/ad4bcee03207d6b8ec88fc88a3101c0e to your computer and use it in GitHub Desktop.
resource "aws_security_group" "elb" {
name = "terraform-go-api"
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_elb" "example" {
name = "terraform-go-api"
availability_zones = ["eu-west-1b"]
security_groups = ["${aws_security_group.elb.id}"]
listener {
lb_port = 80
lb_protocol = "http"
instance_port = 9000
instance_protocol = "http"
}
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 3
interval = 30
target = "HTTP:9000/"
}
}
output "elb_dns_name" {
value = "${aws_elb.example.dns_name}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment