pulumi/pkg/engine
bors[bot] 8e83ce445d
Merge #13480
13480: Fix resoloution of aliased parent aliases. r=Frassle a=Frassle

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes https://github.com/pulumi/pulumi/issues/13324.

When collapsing an alias that specifies a parent we need to use the parents alias if it had one. 

This is so that for example given a state with three resources:
```
urn:pulumi:test::test::prog:index:myStandardType::resA
urn:pulumi:test::test::prog:index:myType::resB
urn:pulumi:test::test::prog:index:myType$pkgAⓂ️typA::resC
```
Which is then updated such that resB and resC are re-parented to resA we end up with the following alias specifications:
```
resB: { NoParent = True}
resC: { Parent = "urn:pulumi:test::test::prog:index:myStandardType$prog:index:myType::resB
```
Note that resC's alias uses the _new_ URN for resB. If we do a simple collapse of that alias we'd end up trying to find an old URN of `urn:pulumi:test::test::prog:index:myStandardType$prog:index:myType$pkgAⓂ️typA::resC` but actually it's old URN would have been `urn:pulumi:test::test::prog:index:myType$pkgAⓂ️typA::resC`.

This change fixes alias to URN collapse to take into account if the parent was aliased so we get the correct old URN.

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Fraser Waters <fraser@pulumi.com>
2023-07-17 16:28:39 +00:00
..
lifecycletest Merge #13480 2023-07-17 16:28:39 +00:00
deployment.go [engine] Add support for source positions 2023-07-10 14:35:40 -07:00
destroy.go [engine] Add support for source positions 2023-07-10 14:35:40 -07:00
detailedDiff.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
detailedDiff_test.go [display] Refactor diff translation and display. (#9363) 2022-04-07 12:05:33 -07:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
engine.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
errors.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
events.go [apitype] Add RetainOnDelete to StepEventStateMetadata 2023-06-26 12:50:39 -07:00
events_test.go Do not panic when sending events to closed emitter (#10489) 2022-08-25 12:43:10 -04:00
eventsink.go chore: WriteString(Sprintf(..)) => Fprintf(..) 2023-03-01 13:22:33 -08:00
import.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
journal.go sdk/go: Remove 'nolint' directives from package docs 2023-01-06 09:06:47 -08:00
plugin_host.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
plugins.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
plugins_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
project.go Update error handling (#8406) 2021-11-12 18:37:17 -08:00
query.go Pass PULUMI_CONFIG through to provider plugins 2023-04-05 10:17:18 +01:00
refresh.go [engine] Add support for source positions 2023-07-10 14:35:40 -07:00
snapshot.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
update.go [engine] Add support for source positions 2023-07-10 14:35:40 -07:00
update_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00