pulumi/sdk
bors[bot] 45dddd89fe
Merge #11422
11422: [sdk/python] Don't error on type mismatches when using input values for outputs r=justinvp a=justinvp

When resolving a resource's outputs, if an output value is missing (and it's not a preview), the SDK will see if there was an input prop of the same name as the output prop and use that input value as the value for the output. We do this across our SDKs. It can be problematic when the input prop's type isn't the same as the output prop's type. In the Python SDK, if the input value is a `dict` and the type of the output cannot be converted from a `dict`, then the SDK currently raises an `AssertionError`, which causes `pulumi up` to fail. This is inconsistent with the other language SDKs, which don't error during `pulumi up` in such cases.

This change changes the behavior of the Python SDK to not error when attempting to use an input value for the output value when there is a type mismatch. Instead of raising an error, `None` is returned, which is the same value that would be used if there had been no input value available to fill-in.

Note that this behavior of filling in input values for missing output values has mostly worked OK for custom resources where there's generally a 1:1 match between inputs/outputs, but obviously it does not work well when that's not the case (which is likely to be more common now with components). We likely need to re-think this overall for all SDKs, as a separate, future change (i.e. having some way to opt-in to disabling this behavior).

Fixes #11416

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2022-11-21 22:43:42 +00:00
..
dotnet attempt to select stack then create 2022-11-18 11:06:20 -08:00
go attempt to select stack then create 2022-11-18 11:06:20 -08:00
nodejs attempt to select stack then create 2022-11-18 11:06:20 -08:00
proto Engine and Golang support for shimless providers 2022-11-14 11:25:41 +00:00
python [sdk/python] Don't error on type mismatches when using input values for outputs 2022-11-21 11:03:50 -08:00
README.md Update sdk/README.md 2022-11-21 11:24:56 -08:00
go.mod [cli] Experimental support for remote operations 2022-10-27 16:15:59 -07:00
go.sum Use project schema to validate projects we load 2022-09-02 10:09:24 +01:00

README.md

Pulumi Language SDKs

This directory contains Pulumi SDKs for the following languages:

See the respective READMEs for information about installing and using these libraries.

The language providers work by implementing gRPC interfaces defined in the top level directory proto.