Fix illegal cast in resource constructors when secret-wrapping input arguments. #11673
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #11664 after new SDK gen. Will require an update to pulumi-aws using this branch or a new release.
Codegen for wrapping input properties as secrets performed an incorrect cast, as seen in Pulumi's AWS classic SDK.
Using the sample program and the resource constructor described in #11664 as our test case, from
pulumi-aws/sdk/v5/go/aws/secretmanager/secretVersion.go
:args.SecretBinary
is of typepulumi.StringPtrInput
andpulumi.ToSecret
returnspulumi.Output
as an Output-wrapped value marked secret.As
StringPtrInput
is an interface accepting multiple input types, the return value would be eitherpulumi.StringOutput
orpulumi.StringPtrOutput
. These are both concrete types, and casting to the incorrect one would panic.Fortunately we can cast back to the input type, as verified by building the new codegen and testing the Pulumi program in #11664.
The new codegen below converts an input type
T
topulumi.Output
, then casts back toT
.