mirror of https://github.com/pulumi/pulumi.git
4c0b08d8ae
This change fixes a regression in the step generator when looking for old resources. When generating steps for a register resource event, we previously looked for old resources first by the resource's URN and then by aliases. This regressed with #10819: ```diff - for _, urnOrAlias := range append([]resource.URN{urn}, goal.Aliases...) { + aliases[urn] = struct{}{} + for urnOrAlias := range aliases { ``` Previously, aliases were in a slice and we always looked for the URN first, then aliases. With #10819, aliases changed to being stored in a map (a set). The URN was added to the map before iterating over it, but there's no guarantee it will be looked at first (iteration order for maps is unspecified), and with the current behavior when there are aliases in the map, the URN very likely won't come first. This can lead to duplicate resources in the state (stack corruption) when the wrong old resource is chosen. The fix is to move back to always checking for old resources using the URN first. We also move back to maintaining aliases in a slice for consistent ordering. Fixes #13848 |
||
---|---|---|
.. | ||
step1 | ||
step2 | ||
step3 |