has anybody tried storing a integer in your stack ...
# python
r
has anybody tried storing a integer in your stack configuration file, and read it back, only to discover that it is a
str
? I know that the YAML spec allows for specifying an “int” type, which I’ve done in `Pulumi.dev.yaml`:
Copy code
config:
  test:az_count: !!int 3
I’ve tested PyYAML and read back the YAML and confirmed that
test:az_count
is read back as an int, but when I try in Pulumi to get the config, I get an str instead:
Copy code
error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/Users/jf/.../pulumi/./__main__.py", line 37, in <module>
        for i in range(0, vars.az_count):
    TypeError: 'str' object cannot be interpreted as an integer
here’s `vars.py`:
Copy code
import pulumi

config = pulumi.Config()
az_count = config.get('az_count')
I’ve found 2 workarounds, but honestly I am disappointed and would expect that
config.get
would just return you the right type: 1. use
config.get_int()
so that you dont even need to (in fact it does not matter!) specify
!!int 3
2. use
int()
on the value u read back from
config.get()