Hello, I could use some help here. I'm not sure wh...
# python
f
Hello, I could use some help here. I'm not sure what is happening. The issue almost seems like a bug. I'm running latest pulumi version. The vpc in question does exist egress_vpc: vpc-03b6755e47c26a69f. I tried setting various combinations of the depends_on. But this doesn't seem to change the outcome.
Copy code
# failure if I exclude the local route
  egress_vpc_fw_public_subnet_rtb = aws.ec2.RouteTable(custom_tags['Name'],
        vpc_id=egress_vpc.id,
        routes=[
        aws.ec2.RouteTableRouteArgs(cidr_block="0.0.0.0/0",gateway_id=egress_igw.id)
        ],
       
        tags=custom_tags,
        opts=ResourceOptions(depends_on=[tgw, egress_igw],parent=egress_vpc)) 



 aws:ec2:RouteTable (egress_vpc_fw_public_subnet_us_east_2_rtb):
    error: 1 error occurred:
        * updating urn:pulumi:dev::transitgateway::aws:ec2/vpc:Vpc$aws:ec2/routeTable:RouteTable::egress_vpc_fw_public_subnet_us_east_2_rtb: 1 error occurred:
        * error deleting Route in Route Table (rtb-08121bf0496297bff) with destination (10.31.0.0/16): InvalidParameterValue: cannot remove local route 10.31.0.0/16 in route table rtb-08121bf0496297bff
        status code: 400, request id: fc0dcdd7-ce6f-4ec8-92e7-250c268c4933





# failure if I add the local route

egress_vpc_fw_public_subnet_rtb = aws.ec2.RouteTable(custom_tags['Name'],
        vpc_id=egress_vpc.id,
        routes=[
        aws.ec2.RouteTableRouteArgs(cidr_block="0.0.0.0/0",gateway_id=egress_igw.id),
	aws.ec2.RouteTableRouteArgs(cidr_block=egress_vpc.cidr_block,local_gateway_id=egress_vpc.id)
        ],
       
        tags=custom_tags,
        opts=ResourceOptions(depends_on=[tgw, egress_igw],parent=egress_vpc))

error: 1 error occurred:
        * updating urn:pulumi:dev::transitgateway::aws:ec2/vpc:Vpc$aws:ec2/routeTable:RouteTable::egress_vpc_fw_public_subnet_us_east_2_rtb: 1 error occurred:
        * error creating Route in Route Table (rtb-08121bf0496297bff) with destination (10.31.0.0/16): InvalidLocalGatewayID.Malformed: Invalid id: "vpc-03b6755e47c26a69f"
        status code: 400, request id: 3e59a09d-b7b7-4dfa-b46d-ae0caf214ee7
I believe I found the issue: I was editing/adding the routes inline when I created the route table. What tipped me off to the problem was this terraform link. https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route So I changed my code to this: 1. create the route table first 2. use aws.ec2.Route to add additional routes
Copy code
egress_vpc_fw_public_subnet_rtb = aws.ec2.RouteTable(custom_tags['Name'],
        vpc_id=egress_vpc.id,

        tags=custom_tags,
        opts=ResourceOptions(depends_on=[tgw, egress_igw, egress_vpc]))


    route1 = aws.ec2.Route("route1",
    route_table_id=egress_vpc_fw_public_subnet_rtb.id,
    destination_cidr_block="0.0.0.0/0",
    gateway_id=egress_igw.id,
    opts=pulumi.ResourceOptions(depends_on=[egress_vpc_fw_public_subnet_rtb]))