Last active
August 29, 2015 14:24
-
-
Save thegedge/7502644c03f69de7f21b to your computer and use it in GitHub Desktop.
Terraform count on aws_instance resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "instances" {} | |
variable "flavor" {} | |
variable "ami" {} | |
variable "ami_list" {} | |
resource "aws_instance" "default" { | |
count = "${var.instances}" | |
ami = "${var.ami}" | |
instance_type = "${var.flavor}" | |
} | |
resource "aws_instance" "varied" { | |
count = "${var.instances}" | |
ami = "${element(split(",", var.ami_list), count.index)}" | |
instance_type = "${var.flavor}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment