-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can use this module to configure each EC2 Instance to use a different AZ #54
Comments
I manage to solve this by changing the type of subnet_id from string to list (subnet_ids) in variable.tf variable "subnet_ids" { Below change in main.tf subnet_id = "${element(var.subnet_ids,count.index)}" It is working as expected :) |
Why don't you put this into a pull request? Also, how would this work if you are spinning up fewer instances than subnets provided? ie: two instances but only gave a list of one subnet. |
I added the pull request. Terraform uses modular arithmetic with the element function. So if more instances are requested than provided subnet ids, Terraform will just wrap around the list of ids and start from the beginning. See element-list-index. |
Fixed in v1.15.0 by @craigsands |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
The type of subnet_id is string
So how can use this module to configure each EC2 Instance to use a different AZ?
Thanks in advance.
Devesh
The text was updated successfully, but these errors were encountered: