Hi Guys, I am struggling to add route to an existi...
# golang
Hi Guys, I am struggling to add route to an existing route table in pulumi-aws. I want to use func ec2.GetRouteTable. but I am not sure how to convert vpc.DefaultRouteTableId (created by vpc,default route table) to pulumi.IDInput. I want to create a VPC then add route to its default route table the full scenario is 1. create ec2 instance 2. create vpc 3. create igw 4. link igw to vpc 5. add default route in vpc main route table, point to route table
Copy code
func GetRouteTable(ctx *pulumi.Context,
	name string, id pulumi.IDInput, state *RouteTableState, opts ...pulumi.ResourceOption) (*RouteTable, error) {
	var resource RouteTable
	err := ctx.ReadResource("aws:ec2/routeTable:RouteTable", name, id, state, &resource, opts...)
	if err != nil {
		return nil, err
	return &resource, nil
Copy code
_, err = ec2.NewRoute(ctx, "route", &ec2.RouteArgs{
		RouteTableId:         myVpc.DefaultRouteTableId,
		DestinationCidrBlock: pulumi.String(""),
		GatewayId:            igw.ID(),
	}, pulumi.Parent(myVpc))