无法使用 terraform 在目标组内添加多个 target_id [英] Not able to add multiple target_id inside targer group using terraform

查看:24
本文介绍了无法使用 terraform 在目标组内添加多个 target_id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 terraform 脚本创建目标组并将多台机器连接到目标组.

I'm trying to create target groups and attach multiple machines to the target groups using terraform script.

我无法附加多个 target_id 请帮助我实现这一点.

I'm not able to attach multiple target_id please help me to achieve this.

推荐答案

感谢您的快速回复.

实际上为 aws_alb_target_group_attachment 提供单独的标签(如 test1 和 test2)帮助我在一个标签组中添加多个目标实例.

Actually giving seperate tag like test1 and test2 for aws_alb_target_group_attachment helped me to add multiple target instances inside one taget group.

resource "aws_alb_target_group_attachment" "test1" {
  target_group_arn = "${aws_alb_target_group.test.arn}"
  port             = 8080
  target_id        = "${aws_instance.inst1.id}"
}
resource "aws_alb_target_group_attachment" "test2" {
  target_group_arn = "${aws_alb_target_group.test.arn}"
  port             = 8080
  target_id        = "${aws_instance.inst2.id}"
}

这篇关于无法使用 terraform 在目标组内添加多个 target_id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆