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

proud-art-41399

12/07/2021, 2:19 PM
Is there a way to specify type when setting stack config value? Or at least enforce consistency. Consider these two commands:
Copy code
pulumi config set --path 'foo["bar"]' 100
pulumi -C infra/ config set 'baz' 100
These result in this stack config:
Copy code
test:baz: "100"
test:foo:
  bar: 100
i.e. it's a string value for top-level key while it's number for nested key.
b

billowy-army-68599

12/07/2021, 2:20 PM
this looks like a bug, it should set the value correctly each time. could you open an issue?
p

proud-art-41399

12/07/2021, 3:16 PM
This is what I found in the documentation for
get_object()
Python method (https://www.pulumi.com/docs/reference/pkg/python/pulumi/#pulumi.Config.get_object):
This routine simply JSON parses and doesn’t validate the shape of the contents.
while for
get()
method (https://www.pulumi.com/docs/reference/pkg/python/pulumi/#pulumi.Config.get) it explicitly returns `str`:
get(key: str) → Optional[str]
I guess the same or similar logic applies for the Pulumi CLI. Considering the docs, I initially thought it's awkward but desired behavior. Anyway I'll open an issue 👍.