Nodes are created across the given subnets.
This commit is contained in:
@@ -3,7 +3,7 @@ resource "aws_instance" "nodes" {
|
||||
instance_type = var.ec2-instance-type
|
||||
# TODO Make this a variable.
|
||||
associate_public_ip_address = true
|
||||
subnet_id = var.subnet-id
|
||||
subnet_id = element(var.subnet-ids, count.index % length(var.subnet-ids))
|
||||
vpc_security_group_ids = var.security-group-ids
|
||||
user_data = element(var.user-datas.*.rendered, count.index)
|
||||
count = var.num-nodes
|
||||
|
||||
@@ -25,9 +25,9 @@ variable "user-datas" {
|
||||
description = "A list of cloud-init configs that get applied to their corresponding node."
|
||||
}
|
||||
|
||||
variable "subnet-id" {
|
||||
description = "The ID of the subnet that all the nodes will be added to."
|
||||
type = string
|
||||
variable "subnet-ids" {
|
||||
description = "An array of subnet ids. These subnets will be round robined as the subnet to use for each node."
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "security-group-ids" {
|
||||
|
||||
Reference in New Issue
Block a user