我尝试使用的模块,AWS应用和网络负载均衡器(ALB &北草坪会议大楼)平台模块,https://github.com/terraform-aws-modules/terraform-aws-alb。下面是应用程序负载均衡器的示例用法:
module "alb" {
source = "terraform-aws-modules/alb/aws"
version = "~> 5.0"
name = "my-alb"
load_balancer_type = "application"
vpc_id = "vpc-abcde012"
subnets = ["subnet-abcde012", "subnet-bcde012a"]
security_groups = ["sg-edcd9784", "sg-edcd9785"]
access_logs = {
bucket = "my-alb-logs"
}
target_groups = [
{
name_prefix = "pref-"
backend_protocol = "HTTP"
backend_port = 80
target_type = "instance"
}
]
https_listeners = [
{
port = 443
protocol = "HTTPS"
certificate_arn = "arn:aws:iam::123456789012:server-certificate/test_cert-123456789012"
target_group_index = 0
}
]
http_tcp_listeners = [
{
port = 80
protocol = "HTTP"
target_group_index = 0
}
]
tags = {
Environment = "Test"
}
}我知道target_groups是一个数组。但是,为什么target_group_index =0而不是target_group_index =1或target_group_index = 2呢?指数0是多少?
发布于 2020-11-23 00:47:53
在您发布的示例中,只有一个目标组 (TG):
target_groups = [
{
name_prefix = "pref-"
backend_protocol = "HTTP"
backend_port = 80
target_type = "instance"
}
]因此,侦听器使用target_group_index = 0来指示它们应用于这个特定的TG。如果您有更多的TGs,您将使用target_group_index = 1, 2, 3 ...来指定哪个侦听器应用于每个TG。
https://stackoverflow.com/questions/64961193
复制相似问题