When creating a vpc resource in AWS Crosswalk (aws...
# python
l
When creating a vpc resource in AWS Crosswalk (awsx), is it possible to iterate over the output values in vpc.private_subnet_ids to create a custom route in each of the route tables? I've been trying a few different apply/lambda/Output iterations, and I can't get anything to actually create the new routes.
Copy code
def set_route_tables(subnetIds):
    for subnetId in subnetIds:
        # Get the current routeTable for the subnet. Pulumi creates a new table for each subnet via awsx in vpc creation
        routeTable=aws.ec2.get_route_table(subnet_id=subnetId)
        
        # Create the route to MongoDB Atlas
        mongoRoute=aws.ec2.Route(env + "-mongoroute-" + subnetId, 
            route_table_id=routeTable.id,
            destination_cidr_block=mongoContainer.results[0].atlasCidrBlock,
            vpc_peering_connection_id=mongoPeering.connectionId,
        )

vpc.private_subnet_ids.apply(lambda subnetIds: set_route_tables(subnetIds))
👍 1