I'm looking for a data+code structure to read Pulu...
# typescript
o
I'm looking for a data+code structure to read Pulumi Config data without declaring every individual name in code. It seems using --path gets close but all the examples show explicit named fields. My next attempt will be using --path to define an array of [name, value] pairs. regarding Config --path Anyone found a trick for reading all pulumi config data without naming each field in code? ... edit: the trick is to use
Copy code
pulumi.runtime.allConfig()
l
Reading it to what? Do you mean, building up a map of nested key:value pairs?
o
Indeed. That seems the more reasonable option that pre-defining a rigid struct with all the duplicate declarations that entails.
More like a normal JSON or YAML key:value tree.
l
pulumi.Config gives you that out of the box. Can you pass the entire object around and use it as-is?
o
My overall goal is to pass all the Config values into Dockerfile via ARG+ENV without naming every individual key. Do you have a way?
To answer your question, no I can't use the Config object as is. The config data needs to leave Pulumi as text.
l
I believe I did something like that a while ago, then replaced it with simpler code. I'll have a quick hunt through old commits...
Found it!
pulumi.runtime.allConfig()
.
Copy code
const config = pulumi.runtime.allConfig();
for (let kv in config) {
  <http://pulumi.log.info|pulumi.log.info>(`I see ${kv}: ${config[kv]}`);
}
o
Thanks! I'll kick the tires.
WORKS! Even the secrets make it all the way thru to Docker. Thanks again!
👍 1