https://pulumi.com logo
Title
c

creamy-knife-93354

05/11/2021, 3:28 PM
Hi! Does anyone have any idea on how I can clean this up? This happens during a
pulumi destroy
. Do I have to resolve things manually in the AWS Console (e.g. by mapping the VPC to a different route table, or something)?
aws:ec2:RouteTable (development-vpc-route-table-public):
    error: deleting urn:pulumi:development::playground-infrastructure::aws:ec2/routeTable:RouteTable::development-vpc-route-table-public: 1 error occurred:
        * InvalidParameterValue: cannot disassociate the main route table association rtbassoc-035832433d2a099be
        status code: 400, request id: c0f480d9-abe5-472d-96f2-27c71a837aff
b

billowy-army-68599

05/11/2021, 3:30 PM
you will unfortunately, yes. Do you know where this route table came from? generally you'll need to set up your own route table in the Pulumi state to avoid this
c

creamy-knife-93354

05/11/2021, 3:34 PM
Got it, thanks. Pretty sure this route table in fact is defined in Pulumi, which I've assigned to the VPC using a
MainRouteTableAssociation
. Not sure what's gone wrong here...
b

billowy-army-68599

05/11/2021, 3:34 PM
any chance you can share some code?
c

creamy-knife-93354

05/11/2021, 3:41 PM
Yeah, nothing too fancy in this part 🤷
var vpcRouteTable = new RouteTable($"{stack}-vpc-route-table-public", new RouteTableArgs
            {
                VpcId = vpc.Id,
                Routes = new []
                {
                    new RouteTableRouteArgs
                    {
                        CidrBlock = "0.0.0.0/0",
                        GatewayId = igw.Id,
                    }
                }
            });

            var vpcRouteTableAssociation = new MainRouteTableAssociation($"{stack}-vpc-route-table-association",
                new MainRouteTableAssociationArgs
                {
                    VpcId = vpc.Id,
                    RouteTableId = vpcRouteTable.Id
                });
b

billowy-army-68599

05/11/2021, 3:43 PM
When I create VPCs, I generally never use the main route table association because it creates some weird dependency/ordering issues which it seems like you're seeing
c

creamy-knife-93354

05/11/2021, 3:48 PM
Thanks again, I will steer away from it going forward 😄