Multiple availability zones with terraform on AWS

489 views
Skip to first unread message

ColOfAbRiX

unread,
Sep 4, 2017, 1:10:54 PM9/4/17
to Terraform
Hi all,

I'm trying to create EC2 instances using a module and the count parameter but I don't know how to tell terraform to use the two subnets of the App tier. An additional constraint I have is to use static IP addresses (or a way to have a deterministic private name)

I just posted this question on StackOverflow because I didn't think of coming here in the first place, so I'm not duplicating it here.

I'm really struggling with this and any help would be really appreciated.

Many thanks in advance,
Fabrizio

Lennard Seah

unread,
Sep 5, 2017, 2:10:48 AM9/5/17
to Terraform
from: https://www.terraform.io/docs/providers/aws/d/subnet_ids.html

  subnet_id     = "${element(data.aws_subnet_ids.private.ids, count.index)}"

Isaac Perez

unread,
Sep 5, 2017, 3:28:39 AM9/5/17
to Terraform
Good examples here:

Also recommend their book, Terraform: Up and Running

El dilluns, 4 setembre de 2017 18:10:54 UTC+1, ColOfAbRiX va escriure:

ColOfAbRiX

unread,
Sep 5, 2017, 6:35:21 AM9/5/17
to Terraform
Found a solution and posted on Stack Overflow. Thanks also to you guys,  you pointed me to a very nice resource
Reply all
Reply to author
Forward
0 new messages