are there any helper functions in any of the pulum...
# general
b
are there any helper functions in any of the pulumi packages for converting javascript objects to yaml strings?
so i can, for instance, easily create a config map that ends up as a
config.yml
g
No, don't believe we have any built-in helpers for that. You can bring in third-party libraries though. 🙂
👍 1
w
In particular - we ourselves use this package: https://www.npmjs.com/package/js-yaml
b
@white-balloon-205 it gave me an error about promises. I guess I'd have to
.apply
any pulumi input/output stuff?
darn, it really seems like i can't render yaml with a pulumi output 😞
g
can you share your code you're trying?
b
Copy code
let clientSecret = config.requireSecret('clientSecret');
const config = {client_secret: clientSecret};
const cm = new kx.ConfigMap("vouch-cm", {
    data: {"config.yml": yaml.dump(config)}
});
there's more structure to the config, but that's the relevant part
w
I believe this should work:
Copy code
let clientSecret = config.requireSecret('clientSecret');
const cm = new kx.ConfigMap("vouch-cm", {
    data: {"config.yml": clientSecret.apply(s => yaml.dump({client_secret: s})}
});
b
it does not 😞
YAMLException: unacceptable kind of an object to dump [object Promise]
w
Are you sure you used the code snippet above? I don't see how that code could produce that message.
b
woops! typo in the code. you're right, it does work.
thanks
👍 1