【问题标题】:Terraform AWS Gateway Load Balancer SchemeTerraform AWS 网关负载均衡器方案
【发布时间】:2021-10-26 22:14:07
【问题描述】:

我在尝试使用 terraform 创建网关负载平衡器时不断收到以下错误:

错误:创建网关负载均衡器时出错:ValidationError:网关负载均衡器不支持方案。

我使用以下资源来创建它:

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,
  )
}

并且类型设置为网关。谁能帮帮我?

【问题讨论】:

    标签: amazon-web-services terraform


    【解决方案1】:

    来自 ELB2 API 文档 [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. <------------ !
    

    在哪里Scheme='internet-facing'|'internal'


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

    【讨论】: