mirror of https://github.com/pulumi/pulumi.git
45dddd89fe
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> |
||
---|---|---|
.. | ||
dotnet | ||
go | ||
nodejs | ||
proto | ||
python | ||
README.md | ||
go.mod | ||
go.sum |