尝试使用此公共模块https://github.com/mineiros-io/terraform-aws-lb-listener对于aws lb_ lister,我收到这个错误:
in module "terraform-aws-lb-listener-443to80":
forward = {
An argument named "forward" is not expected here.
Operation failed: failed running terraform plan (exit 1);
当尝试使用这样的模块时:
module "terraform-aws-lb-listener-443to80" {
source = "git@github.com:mineiros-io/terraform-aws-lb-listener.git?ref=v0.0.1"
port = "443"
protocol = "HTTPS"
ssl_policy = "ELBSecurityPolicy-2016-08"
certificate_arn = data.aws_acm_certificate.general.arn
load_balancer_arn = module.aws_alb.arn
forward = {
target_group = {
arn = module.aws_lb_target_group_80.arn
}
target_group = {
arn = module.aws_lb_target_group_ip.arn
}
}
}
我需要一些关于如何正确使用这个模块的指导,因为目前还缺乏这些例子。我试图将两个目标群体与听众联系起来;为此,需要使用前向块。
forward
应该是action
:的一部分
module "terraform-aws-lb-listener-443to80" {
source = "git@github.com:mineiros-io/terraform-aws-lb-listener.git?ref=v0.0.1"
port = "443"
protocol = "HTTPS"
ssl_policy = "ELBSecurityPolicy-2016-08"
certificate_arn = data.aws_acm_certificate.general.arn
load_balancer_arn = module.aws_alb.arn
action {
forward = {
target_groups = [
{arn = module.aws_lb_target_group_80.arn},
{arn = module.aws_lb_target_group_ip.arn}
]
}
}
}
请检查有关如何正确使用它的操作说明。
这确实对我有效。对@Marcin的回答进行了一些细微的更改,但它确实有所帮助。
module "terraform-aws-lb-listener-443to80" {
source = "git@github.com:mineiros-io/terraform-aws-lb-listener.git?ref=v0.0.1"
port = "443"
protocol = "HTTPS"
ssl_policy = "ELBSecurityPolicy-2016-08"
certificate_arn = data.aws_acm_certificate.general.arn
load_balancer_arn = module.aws_alb.arn
default_action = {
type = "forward"
forward = {
target_groups = [
{
arn = module.aws_lb_target_group_80.arn
#weight = 499
},
{
arn = module.aws_lb_target_group_ip.arn
#weight = 499
}
]
}
}
}