Is there a way to recover from this? ``` error: p...
# general
s
Is there a way to recover from this?
Copy code
error: post-step event returned an error: failed to save snapshot: after mutation of snapshot: resource urn:pulumi:pulumi-subnets-test-dev::pulumi-subnets-test::operator-error:aws:Vpc$aws:ec2/vpc:Vpc$aws:ec2/subnet:Subnet$aws:ec2/routeTableAssociation:RouteTableAssociation::demo-public-rta-1 dependency urn:pulumi:pulumi-subnets-test-dev::pulumi-subnets-test::aws:ec2/vpc:Vpc$aws:ec2/routeTable:RouteTable::demo-public-rt refers to missing resource
Doing a
pulumi destroy
results in the same error message when it fails to load the plugin:
Copy code
error: failed to load resource plugin aws: failed to perform plugin load callback: failed to save snapshot: after mutation of snapshot: resource urn:pulumi:pulumi-subnets-test-dev::pulumi-subnets-test::operator-error:aws:Vpc$aws:ec2/vpc:Vpc$aws:ec2/subnet:Subnet$aws:ec2/routeTableAssociation:RouteTableAssociation::demo-public-rta-1 dependency urn:pulumi:pulumi-subnets-test-dev::pulumi-subnets-test::aws:ec2/vpc:Vpc$aws:ec2/routeTable:RouteTable::demo-public-rt refers to missing resource
m
This gets a bit gross: you're going to need to export the stack's checkpoint, edit it manually to remove the offending dependency, and import the repaired checkpoint.
The export is performed by incanting
pulumi stack export
. This will dump the checkpoint to
stdout
, so you'll want to redirect to a file.
The checkpoint is exported as JSON, so I usually do something like
$ pulumi stack export > d.json
Once you have the exported checkpoint in hand, it is probably sufficient to search for
urn:pulumi:pulumi-subnets-test-dev::pulumi-subnets-test::aws:ec2/vpc:Vpc$aws:ec2/routeTable:RouteTable::demo-public-rt
. If my guess is correct (and it certainly may not be), you'll find a single reference to this resource in the dependency list for
urn:pulumi:pulumi-subnets-test-dev::pulumi-subnets-test::operator-error:aws:Vpc$aws:ec2/vpc:Vpc$aws:ec2/subnet:Subnet$aws:ec2/routeTableAssociation:RouteTableAssociation::demo-public-rta-1
. You'll need to delete that reference from the list.
Once the delete is finished, you can import the repaired checkpoint using
$ pulumi stack import < repaired.json
.
I'd recommend saving the original, invalid checkpoint just in case of further disaster.
(it would also be helpful if you can share it with myself or @white-balloon-205 via DM)
cc @bitter-oil-46081 who has hit this recently and may also be able to help
b
In my case I ran into this when trying to create a RolePolicyAttachment, using an
aws.iam.Role
that I obtained via
aws.iam.Role.get
. Since this resource was "read" it is not in the checkpoint. Presumably https://github.com/pulumi/pulumi/issues/1521 when fixed will address my case.
In my case I was able to "recover" by exporting the checkpoint with
pulumi stack export
, hand editing to remove the bogus URN from the list of dependencies, and then import it and run my program again, after editing it so I didn't immediately fall into this case again.
s
Ah, that makes sense. In this case the offending item was the default route table of a VPC
I’ll try exporting and manually editing the checkpoint