Aliasing allows two definitions of the same resource to be applied #11173
Labels
area/engine
Pulumi engine
kind/bug
Some behavior is incorrect or out of spec
resolution/fixed
This issue was fixed
Milestone
What happened?
As part of a refactoring, we attempted to rename all our pulumi resources with a consistent pattern using the Alias feature. Our changes previewed and applied with out an issue, but when we attempted to apply new changes, pulumi failed with
error: post-step event returned an error: failed to verify snapshot: duplicate resource <urn>
. As part of the renaming of our pulumi resources, we also have relocated them to a different place in the code, but apparently, we forgot to clean up some of the old resources with the old name. Typically, we would have gotten a duplicate resource error on pulumi preview. However, the use of aliasing seems to have prevented pulumi from erroring on the presence of duplicate resources.Steps to reproduce
The change can be reproduced using a dev vault server:
Pulumi Go code
pulumi up
and create the resourcesPulumi Go code
pulumi up
and you will see that there are no changes, but apply it anyway.Pulumi up with no change
pulumi up
again and you will see that there are no changes, but apply it anyway. This will result in error:Pulumi up with no change
Expected Behavior
We expected that pulumi preview would error out because of the duplicate resource definition wether one of the resources is an alias of the other or not.
Actual Behavior
Pulumi instead allowed two definitions of the same resource to be applied, which resulted in breaking the state. Also, because both the preview and apply were successful, we only discovered when trying to make new changes. This broke all our stacks including productions and it required manually deleting the duplicate resources from state in all our pulumi stacks.
Output of
pulumi about
Additional context
I have only tested this on vault pulumi resources. It quite likely that this is a larger issue with Alias implementation and not specific to vault resource definitions.
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: