Home > front end >  Terraform AWS Gateway Load Balancer Scheme
Terraform AWS Gateway Load Balancer Scheme

Time:10-27

I keep getting the follwoing error while trying to create a gateway load balancer with terraform:

Error: error creating gateway Load Balancer: ValidationError: Scheme is not supported for Gateway Load Balancers.

I use the following resource to create it:

resource "aws_lb" "test" {
  for_each = var.load_balancers

  name = each.value["name"]

  internal                                = each.value["internal"]
  load_balancer_type                      = each.value["load_balancer_type"]
  subnets                                 = each.value["subnets"]
  enable_cross_zone_load_balancing        = true

  enable_deletion_protection = false

  tags = merge(
    {
      "Name" = each.value["name"]
    },
    var.tags,
  )
}

And the type is set to gateway. Can anyone help me?

CodePudding user response:

From the ELB2 API documentation [1]:

Scheme (string) --
The nodes of an Internet-facing load balancer have public IP addresses. The DNS name of an Internet-facing load balancer is publicly resolvable to the public IP addresses of the nodes. Therefore, Internet-facing load balancers can route requests from clients over the internet.

The nodes of an internal load balancer have only private IP addresses. The DNS name of an internal load balancer is publicly resolvable to the private IP addresses of the nodes. Therefore, internal load balancers can route requests only from clients with access to the VPC for the load balancer.

The default is an Internet-facing load balancer.

You cannot specify a scheme for a Gateway Load Balancer. <------------ !

Where Scheme='internet-facing'|'internal'.


[1] https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/elbv2.html#ElasticLoadBalancingv2.Client.create_load_balancer

  • Related