Nodes are created across the given subnets.

This commit is contained in:
Curtis Wilson
2021-12-23 13:06:45 -05:00
parent ff956b51d2
commit 18d4c0c4e8
7 changed files with 48 additions and 11 deletions
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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" {