-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Count future plans #17885
Comments
Hi @eredi93! Thanks for reporting this use-case. A potential solution to this problem is being discussed in #17179. While we're not working on this immediately, what I shared there is our current plan to address the problem and -- unless we find problems with the design during prototyping/implementation -- we're intending to address that once we've dealt with some other changes that are required first before it is possible to implement that solution. In particular, our current work to improve the configuration language in other ways is laying some foundations for this by changing some of our internal data structures to support instances that are identified by string keys rather than numeric indices, which is a prerequisite for using a map as the basis for multiple instances. Since we already have #17179 open tracking this, I'm going to close this one just to consolidate the discussion over there. Thanks again for raising this! |
@apparentlymart thanks a million for getting back to me. |
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. |
this issue doesn't actually highlight a bug but more a question about the future plans of changing how
count
works.as right now if you are creating a resource with count, for example a user:
^^ will create 3 users with the names described in the list.
everything works perfectly until you change the list.
I intentionally didn't add
user_3
to the list to highlight the fact that is common for people to forget to add a value to a list.adding the missing
user_3
afteruser_2
will make the users after that to shift, causing the destroy/recreate of those resources as the index changed.you would see the same behavior if you delete an item from the list (except if it is the last one)
what I would like to know is if there are any plans to change this logic as it is quite disruptive.
I'm wondering if terraform could figure out that the other items in the list did not change inserting or shifting the list based on the operation (delete or add of an item).
if there are no plans on changing/improving this logic could you give the good use cases of
count
? I see this being used in several modules (even from Hashicorp partners).should we discourage people from using it? or at least highlight the potential danger?
The text was updated successfully, but these errors were encountered: