在尝试使用terraform创建网关负载均衡器时,我一直得到以下错误:
Error: Error creating gateway Load Balancer: ValidationError: Scheme is not supported for gateway Load Balancer .
我使用以下资源创建它:
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,
)
}
类型设置为网关。有人能帮我吗?
来自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