You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running on Bash will set valid JSON to the config.
$ pulumi config set data '{"active": true, "nums": [1,2,3]}'
$ pulumi config
# result with bash
data {"active": true, "nums": [1,2,3]}
However CMD will result error as follows.
CMD> pulumi config set data '{"active": true, "nums": [1,2,3]}'
Configuration values can be accessed when a stack is being deployed and used to configure behavior.
If a value is not present on the command line, pulumi will prompt for the value. Multi-line values
may be set by piping a file to standard in.
The `--path` flag can be used to set a value inside a map or list:
- `pulumi config set --path outer.inner value` will set the value of `outer` to a map `inner: value`.
- `pulumi config set --path names[0] a` will set the value to a list with the first item `a`.
Usage:
pulumi config set<key> [value] [flags]
PowerShell will not return error, but register invalid JSON, as key missing double quote.
PS> pulumi config set data '{"active": true, "nums": [1,2,3]}'
PS> pulumi config
data {active: true, nums: [1,2,3]}
Workaround
You need escape JSON key with additional double quote for both CMD and PowerShell.
begin: 2 double quote ""
end: 4 double quote """"
PowerShell's JSON string should be quote with ' for simplify problem. Double quote requires additional escape:(
CMD> pulumi config set data "{""active"""": true, ""nums"""": [1,2,3]}"
CMD> pulumi config
data {"active": true, "nums": [1,2,3]}
PS> pulumi config set data '{""active"""": true, ""nums"""": [1,2,3]}'
PS> pulumi config
data {"active": true, "nums": [1,2,3]}
Expected behavior
This may not a Pulumi problem but CMD and PowerShell shell design.
Additional note to a doc would be appreciated.
PowerShell argument would be fixable...?
The text was updated successfully, but these errors were encountered:
Thanks for letting us know about this @guitarrapc! Most of our command line snippets in the docs are for a Unix shell like bash, but we could certainly do a better job showing the equivalent PowerShell/CMD commands for Windows. I've transferred the issue to the docs repo.
Note that in this particular case, we have a new feature we recently added (and still need to document more prominently) that could help set this structured config data without having to specify it as JSON.
pulumi config set --path data.active true
pulumi config set --path data.nums[0] 1
pulumi config set --path data.nums[1] 2
pulumi config set --path data.nums[2] 3
TL;DR
pulumi config set data '{"active": true, "nums": [1,2,3]}'
works on bash, but not on CMD and PowerShell.CMD and PowerShell requires additional escape.
Actual behavior
Document told
pulumi config set data '{"active": true, "nums": [1,2,3]}'
to set JSON to the config.Running on Bash will set valid JSON to the config.
However CMD will result error as follows.
PowerShell will not return error, but register invalid JSON, as
key
missing double quote.Workaround
You need escape JSON key with additional double quote for both CMD and PowerShell.
""
""""
Expected behavior
This may not a Pulumi problem but CMD and PowerShell shell design.
Additional note to a doc would be appreciated.
PowerShell argument would be fixable...?
The text was updated successfully, but these errors were encountered: