Is there a way to reference other yaml files so I ...
# yaml
r
Is there a way to reference other yaml files so I could break up resources into separate yaml files or would I have to go the route of breaking up the stacks and using stack references?
t
Currently the whole stack has to be in a single yaml file. Feel free to open an issue in https://github.com/pulumi/pulumi-yaml/ and explain your use case. Thank you!
❤️ 1
r
Great thanks!
q
You can have a look at combining Pulumi YAML with CUE (there is a video on PulumiTV about it), and author the configurations in CUE and generate the YAML from that. CUE has its own module system.
👍🏼 1
❤️ 1
e
What is CUE?
r
It is a language that is a superset of JSON. Supposed to be easier to work with than YAML or JSON. Since Pulumi YAML gets transpiled into JSON you can write it in Cue among other languages. Anyone feel free to chime in and correct any of that if it is wrong, but that is my understanding.
l
o
@rough-window-15889 @tall-librarian-49374 I wrote a script using our "compiler" option to combine multiple YAML files. It requires the "yq" command line utility: https://github.com/mikefarah/yq Once you have that installed, give this repo a whirl: https://github.com/aaronfriel/pulumi-yaml-multi-file the "dev" stack should at least
pulumi preview
, but I copied it from a sample I'm working on so it may not work as is
Please keep in mind that we really recommend the single file approach, as our error messages are really geared around not using a "compiler" to combine text into one file. We can't report where in those multiple files an error might have come from.
r
Ah clever. Very cool! Thanks for the reply.
h
My use case: I'm experimenting. I'm simply using Pulumi because I like that its YAML spec gives me a no-nonsense way to "pick up where I left off yesterday" when using my A Cloud Guru playgrounds (that only last 6 hours) as a place to try things and fail without costing my employer or myself any money. I'm constantly commenting out and un-commenting things as I try to isolate various parts of the stack and learn more about how they "really work" and why things aren't working as expected. It's annoying to scroll up, scroll down, etc. to comment things out. It'd be so much easier in VSCode to have things grouped conceptually in a way that makes sense to me, and then just comment out a single file-reference for a while.