-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Variable interpolation of a multiple instance resource #636
Comments
Hmm this is interesting... I think this should cause an error. This means that every aws_instance.api depends on every other aws_instance.api. There is no sane way for TF to handle that dependency AFAIK. |
Just to make sure it is clear, as reading over it again it may not have been. The second instance creates this string: |
Theoretically this is possible, but not without major internal refactoring of Terraform. In the short term, I believe we should at least validate this as an error, and I'll make this the goal of this issue. |
For me the problem is more that the interpolation delimiter ( terraform/config/interpolate_walk.go Line 15 in 36f225d
I use the interpolation to get all IPs of a resource itself as well since for me it is not an error if you get the list of known IPs at the time of evaluation. (I preset cassandra seeds via In the case where only the first instance is created I get a single IP and that list expands while other instances come up. |
Note you can use the |
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. |
I'm creating this as a separate issue to #633.
When using the following syntax
${aws_instance.api.*.public_ip}
in thelocal-exec
provisioner it will create the following string when it's running for the second instance:The resource is as follows:
The text was updated successfully, but these errors were encountered: