Hi people, when generating "spec" and "metadata" inputs for kubernetes resources, how would you all suggest handling inputs that should be given as multi-line literals?
for example, a section such as this:
03/27/2021, 7:07 PM
Use triple quotes to start and end them
03/27/2021, 7:20 PM
even when inserting resource IDs and such from other dynamic resources?
And, if im not mistaken, these lines should remove all indentation? If so, that will lead to some not-so-pretty code. But I guess that's alright 🤷. TBH, I was hoping Pulumi had some sort of elegant helper object for this to avoid having to write yaml-in-python
but anyway, thanks @billowy-army-68599!
03/27/2021, 7:56 PM
you could construct the YAML from a dict using the standard YAML function of your language
yeah, normally that is what I would do. But specifically the multi-line literals seemed to be the crux, there, since I don't think it can be expressed with a simple dictionary 🙈. If I'm not mistaken, the examples you provided don't include this either? (although I'm not super-great as TS, so maybe I'm missing it)
btw, going about it the """ way leads to some weird code structure. One can't easily read the yaml anymore. But it works 😅
To connect this with a parallel question (which @billowy-army-68599 was also helpful with 🙏), it's possible that using a transformation would have been the better way to go, here, rather than resorting to fully re-building the yaml file's contents