https://pulumi.com logo
#python
Title
# python
l

lemon-wall-81522

02/26/2019, 9:40 PM
On a lark I tried
Copy code
ig = ec2.InternetGateway(resource_name = 'new-ig', vpc_id = vpc.id)
rt = ec2.RouteTable('new-rt', vpc_id = vpc.id, routes = [ig.id])
and
Copy code
ig = ec2.InternetGateway(resource_name = 'new-ig', vpc_id = vpc.id)
rt = ec2.RouteTable('new-rt', vpc_id = vpc.id, routes = [ig])
Both returned
Copy code
aws:ec2:RouteTable (new-rt):
    error: aws:ec2/routeTable:RouteTable resource 'new-rt' has a problem: route.0: expected object, got string
i

incalculable-sundown-82514

02/26/2019, 10:03 PM
Unfortunately this is a part where our Python docs aren’t sufficient -
routes
has to be a list of dictionaries with a set of keys instead of a string: https://pulumi.io/reference/pkg/nodejs/@pulumi/aws/ec2/#RouteTableArgs-routes
Python snake_cases the properties instead of camelCase like Node, but these keys are the same.
l

lemon-wall-81522

02/26/2019, 10:19 PM
Thanks for the help! I’ll give it a shot. Do you guys take pull requests to the reference documentation? I got the sense it was cobbled together from different sources.
i

incalculable-sundown-82514

02/26/2019, 10:20 PM
unfortunately, it’s autogenerated. We basically have to improve the code generator in pulumi/pulumi-terraform to be better - I’ve been landing a number of fixes that will improve docs, but there’s always more that can be done 😛
the hardest thing here re: Python is that Python, being totally untyped, doesn’t have a great built-in way to document the shape of dictionary objects that get passed as inputs to resources. Boto rolled their own documentation generator to do this
It’s much easier with TypeScript because TypeScript has an actual interface type corresponding to the e.g.
RouteTableArgs
type that encodes the things you can pass to it
l

lemon-wall-81522

02/26/2019, 10:21 PM
Yeah, I saw some type hints in some of the code, but in general it hasn’t seemed to have really had much of an impact (more broadly, not just this project).
I might learn TypeScript mostly, well, for the type support.
i

incalculable-sundown-82514

02/26/2019, 11:03 PM
Yeah, it’s true that TypeScript has a pretty incredible experience re: types.
I’m trying to see what I can do re: Python and IDEs, but unfortunately it looks like there’s not a comparable experience for Python programs.