Terraform: Can't create AWS ELB

Created on 21 Oct 2016  ·  4Comments  ·  Source: hashicorp/terraform

I can't seem to create a AWS ELB..

Terraform Version

0.7.5

Affected Resource(s)

aws_elb

Terraform Configuration Files

resource "aws_elb" "management-ldap" {
  name                          = "core-management-ldap"

  availability_zones            = ["${data.aws_availability_zones.available.names}"]
  security_groups               = ["${aws_security_group.management-slaves-ldap.id}"]
  instances                     = ["${aws_instance.management-slave-ldap.id}"]

  access_logs {
    bucket                      = "mylogs"
    bucket_prefix               = "loadbalancers"
    interval                    = 60
  }

  listener {
    instance_port               = 389
    instance_protocol           = "TCP"

    lb_port                     = 389
    lb_protocol                 = "TCP"
  }

  listener {
    instance_port               = 636
    instance_protocol           = "TCP"

    lb_port                     = 636
    lb_protocol                 = "TCP"
  }

  tags {
    Name                 = "core-management-ldap"
    environment          = "core"
    service              = "management"
  }
}

Error Output

* aws_elb.management-ldap: ValidationError: EC2-Classic load balancer port must be either 25, 80, 443, 465, 587 or 1024~65535 inclusive
        status code: 400, request id: 8d70ef50-97a7-11e6-adc5-13d61f2dba31

Important Factoids

Not running EC2 Classic.

Expected Behavior

ELB should have been created.

Actual Behavior

It wasn't.

Steps to Reproduce

terraform apply

bug provideaws

Most helpful comment

Instead of giving it availability zones, you should give it subnets within your VPC.

Something like...

  subnets            = ["${var.my_public_subnets}"]

All 4 comments

Instead of giving it availability zones, you should give it subnets within your VPC.

Something like...

  subnets            = ["${var.my_public_subnets}"]

Hey @FransUrbo – like @nwalke mentioned, please use subnets to designate your ELB into a VPC. By specifying your availability zones, AWS is trying to place this ELB into a Classic env

Please reopen this, remove the 'bug' keyword and add a 'documentation' instead.

It's not obvious that adding the availability_zone makes it a EC2 Classic. Only that it's required _for_ a EC2 Classic.

https://www.terraform.io/docs/providers/aws/r/elb.html#availability_zones

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings