-
Notifications
You must be signed in to change notification settings - Fork 450
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
std.mergePatch loses hidden fields #2 #1041
Comments
Can't you make them non-hidden? Merge Patch doesn't have a concept of hidden fields because it's a JSON standard. |
Terraform is very particular with what fields it accept; so the short answer no. The longer answer is, yes of course there are workarounds. I have one implemented, but the code is far more readable, maintainable less DRY without it. Now I have to add several lines of boilerplate per module. |
Can you use the language's mixin support instead of std.mergePatch? |
That would be very difficult. In this case, I want to merge several sources. Some of those sources are jsonnet, and there mixin can be used. Others are HCL converted to JSON, one could perhaps write some code to edit the JSON and add |
you could write a wrapper that imports the json and uses it to build an object that will mix together nicely |
I could, many different workarounds one could think of. Personally I believe people would except std.mergePatch to merge Jsonnet objects. My alternatives for my use case is to either create a recursive function that merges Jsonnet objects, which would work like std.mergePatch but without deleting hidden fields, or wait for std.mergePatch to be updated. |
i have come up to the function like this to solve import from json to make it a jsonnet object
|
Sorry for resurrecting an old thread. But I came a cross the same issue the other day. I use Jsonnet for Terraform, and the way I create modules using Jsonnet, and want to pass data between the modules (which are merged using std.mergePatch), hidden fields I want to lookup are missing after I merge them.
The text was updated successfully, but these errors were encountered: