scottslowe-learning-tools/terraform/aws/ic-module/modules/instance-cluster/main.tf
Scott Lowe e260eb828e
Add files for instance-cluster environment
Commit files to show use of 2 separate Terraform modules, including the "instance-cluster" module to spin up a cluster of instances

Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org>
2017-09-24 22:04:11 -06:00

15 lines
456 B
HCL

# Launch a cluster of instances
resource "aws_instance" "instance" {
count = "${var.cluster_size}"
ami = "${var.ami}"
instance_type = "${var.type}"
subnet_id = "${element(var.subnet_list, count.index)}"
key_name = "${var.ssh_key}"
associate_public_ip_address = "${var.assign_pub_ip}"
vpc_security_group_ids = ["${var.sec_group_list}"]
tags {
Name = "${var.name}-${count.index}"
Role = "${var.role}"
}
}