Hi, have a basic question: how do I add an item to...
# getting-started
s
Hi, have a basic question: how do I add an item to a list in the config using the CLI? I tried
pulumi config set aws:allowedAccountIds [0000000]
but I get an error of “zsh: no matches found: [000000]”
pulumi config set aws:allowedAccountIds 000000
works but adds it as a value.
l
I think you have to add the entire list in one go, in JSON notation? Else edit the YAML file directly.
Actually, I've never tried anything like
pulumi config set aws:allowedAccountIds[0] xyz
... might be worth a shot?
s
I tried indexing it as well but that doesn't work
l
Ah, indexing is the way to go, but you need to add the
--path
option to tell it that there's an index in the key.
Copy code
pulumi config set --path 'delete[0]' me
👍 2
From `pulumi config set --help`:
Flags:
-h, --help help for set
--path The key contains a path to a property in a map or list to set
--plaintext Save the value as plaintext (unencrypted)
--secret Encrypt the value instead of storing it in plaintext
Ways of working, eh? I've never used
pulumi config set
, I always edit the file...
s
Ahhhh!! I had tried the
—-path
flag and it didn't work. I noticed your quotes
‘’
around the index just now, and lo and behold…it worked. Haha thanks!
👍 1
l
Yes, need single quotes to ensure sh/bash doesn't parse
[
Or you can liberally sprinkle `\`s...
s
Yeah, the error makes sense now. Thanks!