rhythmic-branch-12845
11/22/2022, 7:31 AMstr
? I know that the YAML spec allows for specifying an “int” type, which I’ve done in `Pulumi.dev.yaml`:
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:
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`:
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()