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()
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by