Check in to allow collaboration.
This commit is contained in:
@@ -8,8 +8,12 @@ resource "aws_instance" "nodes" {
|
||||
# the IP.
|
||||
private_ip = length(var.private-ips) == 0 ? null : element(var.private-ips, count.index)
|
||||
vpc_security_group_ids = var.security-group-ids
|
||||
user_data = element(var.user-datas.*.rendered, count.index)
|
||||
count = var.num-nodes
|
||||
user_data = element(var.user-datas.*.rendered, count.index)
|
||||
root_block_device {
|
||||
volume_size = var.disk-size
|
||||
delete_on_termination = true
|
||||
}
|
||||
count = var.num-nodes
|
||||
|
||||
tags = {
|
||||
Name = "${var.name-prefix}-${count.index}"
|
||||
|
||||
@@ -1,30 +1,36 @@
|
||||
variable "ami" {
|
||||
description = "The AWS AMI to be used for all the nodes"
|
||||
type = string
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "disk-size" {
|
||||
default = 8
|
||||
description = "The size of the root FS disk in GB."
|
||||
type = number
|
||||
}
|
||||
|
||||
variable "ec2-instance-type" {
|
||||
default = "t2.micro"
|
||||
default = "t2.micro"
|
||||
description = "The AWS instance type to use for all nodes."
|
||||
type = string
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "name-prefix" {
|
||||
default = "tf-node"
|
||||
default = "tf-node"
|
||||
description = "This prefix will be applied to all names created by this module."
|
||||
type = string
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "num-nodes" {
|
||||
default = 1
|
||||
default = 1
|
||||
description = "The number of nodes to create from the given input parameters."
|
||||
type = number
|
||||
type = number
|
||||
}
|
||||
|
||||
variable "private-ips" {
|
||||
default = []
|
||||
default = []
|
||||
description = "A list of private IP addresses to use for the nodes. If the list is empty then each node will get an IP assigned from AWS."
|
||||
type = list(string)
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "user-datas" {
|
||||
@@ -33,10 +39,10 @@ variable "user-datas" {
|
||||
|
||||
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)
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "security-group-ids" {
|
||||
description = "A list of security group IDs to be applied to all the nodes."
|
||||
type = list(string)
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user