Hi! Is it possible to store a list as a configurat...
# general
g
Hi! Is it possible to store a list as a configuration value? I would like to store a list of GCP API services for GCP project as a configuration entry (a list of strings).
c
Is this help you?
You can transform....anytime a comasepareted string into a list with a small trick
this is python 😉 I think there should be a solution in Typescript too, but that is not my field...
and this is my input:
g
Thanks @cuddly-eye-68174, yes, I can use a comma-separated entries in a string. I was wondering if there was a first-class list of values feature 🙂
c
oks 🙂
Pulumi config is pretty flat..at the moment...but you can use your own yaml config if you would like that. I was thinking also, but I chose this way to stay close to Pulumi
w
There's some background on this question at https://pulumi-community.slack.com/archives/C84L4E3N1/p1541521827485400?thread_ts=1541491030.477400&cid=C84L4E3N1. We're also tracking adding first class support for richer config types in https://github.com/pulumi/pulumi/issues/2306. There is also support for
config.getObject
which does JSON de-serialization of values so that you can import rich JSON-formatted values easily (including arrays). See https://pulumi.io/reference/programming-model.html#config. Though, to support simple CLI configuration, I personally normally handle arrays just with
.split(",")
.