github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/examples/aws-count/main.tf (about) 1 # Specify the provider and access details 2 provider "aws" { 3 region = "${var.aws_region}" 4 } 5 6 resource "aws_elb" "web" { 7 name = "terraform-example-elb" 8 9 # The same availability zone as our instances 10 availability_zones = ["${aws_instance.web.*.availability_zone}"] 11 12 listener { 13 instance_port = 80 14 instance_protocol = "http" 15 lb_port = 80 16 lb_protocol = "http" 17 } 18 19 # The instances are registered automatically 20 instances = ["${aws_instance.web.*.id}"] 21 } 22 23 24 resource "aws_instance" "web" { 25 instance_type = "m1.small" 26 ami = "${lookup(var.aws_amis, var.aws_region)}" 27 28 # This will create 4 instances 29 count = 4 30 }