【发布时间】:2018-07-09 19:32:36
【问题描述】:
我正在尝试部署多个 EC2 实例,每个实例在不同的子网中使用相同的 aws_instance 资源块。
当我将 count 参数设置为多个服务器时,它会将它们全部建立在同一个子网中。
有没有办法通过 Terraform 实现这一点?
您会在下面找到我的 Terraform 块:
resource "aws_instance" "ec2-instance" {
ami = "${var.ec2_ami}"
instance_type = "${var.instance_type}"
key_name = "${var.key_name}"
vpc_security_group_ids = ["${var.security_group}"]
subnet_id = "${var.subnet_id}"
count = "${var.count}"
root_block_device {
volume_size = "${var.root_volume_size}"
volume_type = "${var.root_volume_type}"
}
tags {
Name = "${var.app_name}"
}
}
【问题讨论】:
标签: amazon-web-services terraform