https://pulumi.com logo
Title
s

sticky-answer-6826

05/16/2022, 9:52 PM
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

little-cartoon-10569

05/16/2022, 10:01 PM
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

sticky-answer-6826

05/16/2022, 10:02 PM
I tried indexing it as well but that doesn't work
l

little-cartoon-10569

05/16/2022, 10:21 PM
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.
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

sticky-answer-6826

05/16/2022, 10:28 PM
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

little-cartoon-10569

05/16/2022, 10:37 PM
Yes, need single quotes to ensure sh/bash doesn't parse
[
Or you can liberally sprinkle `\`s...
s

sticky-answer-6826

05/17/2022, 12:01 AM
Yeah, the error makes sense now. Thanks!