https://pulumi.com logo
#general
Title
# general
g

gifted-island-55702

01/04/2019, 10:32 AM
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

cuddly-eye-68174

01/04/2019, 11:43 AM
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

gifted-island-55702

01/04/2019, 12:57 PM
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

cuddly-eye-68174

01/04/2019, 1:25 PM
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

white-balloon-205

01/04/2019, 7:06 PM
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(",")
.