-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
creation of new objects, when using templates, instead of updating existing ones #50
Comments
Yeah, I am far from happy on that The issue as you said, is that by using the toset, you put the content of your yaml files as keys, which triggers destruction and recreation every time contents changes. If you had the individual manifests in your yaml files, you could do something in a much cleaner way, ie:
filenames would be used as keys, and you would get the contents via file (or templatefile). what should ideally happen with While doable, it would be a breaking change with potentialy disaster for anyone using this data structure (due to the change of the keys). The only solution which can be acceptable (in terms of the breaking changes), is to explicitely deprecate the I will put this on backburner for now (since it can be mostly solved as per my example above and usage of individual manifests per file). |
okay nice, i think i can work with your example, my colleague already came up with something similar. we have to discuss this at our side too. thanks for your feedback anyway! |
@ottes so, I've dig up a bit more... Turns out someone really messed up the documentation... What you want is
and it will generate a nice plan
Notice how the key of the resource is a proper unique attribute? I will update the documentation of the related data source |
yeah, i tried it and it's working in 100% of the cases, thanks for you help, i see the other issue for changing the docs, so i will close this issue, beeing thankful :) |
Okay, well, i hope i am able to explain this behavior and how to solve it.
Think of the following config. When changing something in one of the yaml-files inside the manifests directory, the plan wants to destory&add, instead updating the existing entity.
my colleague posted the following to me: because of the for_each the yaml of the entire document lands in the terraform state, an unwanted sideeffect of that is, when you change a single letter in the manifest, it wants to destroy and recreate it. Instead it should just in-place update it.
we also desire to still have multiple things in a single yaml file, i could bring some example code, i was provides with this, but it only works for a single file inside a directory at the moment, i guess it will be more confusing, to have this posted here directly.
The text was updated successfully, but these errors were encountered: