pulumi/sdk/python/lib
Abhinav Gupta c0e05ada23
sdk/py/Resource: Don't drop merged providers
We previously fixed an issue where a provider specified on a component
resource with `provider=` was not correctly propagated to its children
in the providers bag. (#12161)
The fix was based on setting `resource._provider` only if
the resource package matched the provider package.
Otherwise, the provider would be added to the `providers` bag
to be propagated to the children.

This introduced a bug where we would drop the provider somehow,
and start using the default provider instead.
The change was reverted. (#12520)

The reason for this failure was that the resulting providers bag
was being ignored:

- The bag returned by `_get_providers` is stored on the resulting
  resource:

  f76bd5463b/sdk/python/lib/pulumi/resource.py (L866)

- A request is made to `register_resource`, which calls
  `prepare_resource`:

  f76bd5463b/sdk/python/lib/pulumi/resource.py (L880)
  f76bd5463b/sdk/python/lib/pulumi/runtime/resource.py (L811)

- `register_resource` re-interprets the `provider` and `providers`
  resource options, based on what's in the original `opts` struct

  f76bd5463b/sdk/python/lib/pulumi/runtime/resource.py (L210)

To fix this, we modify the `opts` struct after merging the providers
in `_get_providers`.
2023-04-13 18:12:20 -07:00
..
pulumi sdk/py/Resource: Don't drop merged providers 2023-04-13 18:12:20 -07:00
test Revert "Revert "sdk/py/ComponentResource: Propagate provider to children"" 2023-04-13 15:26:04 -07:00
test_with_mocks [sdk/{nodejs,python}] Fix errors when testing remote components with mocks (#8053) 2021-09-24 06:08:13 -07:00
setup.py Support WhoAmI in automation api for old CLI versions 2023-03-22 13:30:08 +00:00