Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
12433: sdk/go: Don't use Provider for type if package doesn't match r=Frassle a=abhinav In #12296, we started correctly interpreting the Provider argument per other SDKs. but this introduced a regression: the Provider field is now set for resources with mismatched types. This results in a scenario where a provider foo for package X is passed to a resource bar with package Y, with the intent of plumbing it to bar's descendants, but bar attempts to incorrectly use the provider directly. foo := NewXProvider() bar := NewYThing("bar", Provider(foo)) // ... baz := NewXThing("baz", Parent(bar)) // should use foo This worked previously, but with #12296, this fails because NewYThing attempts to use Provider foo directly. To fix this, we need to prevent NewYThing from using a provider that does not match the package that it belongs to. We had to make a similar change to the Python SDK in #12292. https://github.com/pulumi/pulumi/blob/477e0c97660bdbeb28a142057899792d52e63a0b/sdk/python/lib/pulumi/resource.py#L925-L927 The regression test is specific to remote component resources per #12430, but the issue would be caused even for normal component resources before this. Resolves #12430 Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
- Loading branch information
Showing
3 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...-sdk-go--fixes-use-of-provider-option-from-parent-resources-with-mismatched-packages.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
changes: | ||
- type: fix | ||
scope: sdk/go | ||
description: Fixes use of Provider option from parent resources with mismatched packages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters