Hi@akhtar,
You can use an aws_elb load balancer in your Terraform code. This provides an Elastic Load Balancer resource, also known as a "Classic Load Balancer". You can see the below code.
resource "aws_elb" "elb" {
name = "terraform-elb"
availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
listener {
instance_port = 8000
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 3
target = "HTTP:8000/"
interval = 30
}
instances = [aws_instance.foo.id]
cross_zone_load_balancing = true
idle_timeout = 400
connection_draining = true
connection_draining_timeout = 400
tags = {
Name = "terraform-elb"
}
}