mirror of https://github.com/pulumi/pulumi.git
a3cdbad64c
Python dynamic providers get serialised and deserialised, and run in the `pulumi-python` plugin process. This causes issues when trying to use `pulumi.config.Config` in a dynamic provider: * Using `Config` at runtime fails because the process is not setup with the current configuration * When the dynamic provider implementation is in the `__main__` module, the dynamic provider serialization attempts to serialize the global `SETTINGS` object, which pulls in protobuf definitions, which are not serializable by `dill`. To provide a stable API to access configuration in dynamic providers, the provider classes (ResourceProvider) can now implement a `configure` method which is called during provider initialization. ```python class SimpleProvider(ResourceProvider): password: str def configure(self, req: ConfigureRequest): self.password = req.config.get("password") def create(self, props): # Use `self.password`. ... ``` The `configure` method is called when a provider is deserialized. Since we cache the deserialization result, we guarantee that this is only called once per program, and this process level cache serves as a plugin registry. Fixes https://github.com/pulumi/pulumi/issues/17050 --------- Co-authored-by: Will Jones <will@sacharissa.co.uk> |
||
---|---|---|
.. | ||
deploytest | ||
providers | ||
builtins.go | ||
builtins_test.go | ||
deployment.go | ||
deployment_executor.go | ||
deployment_executor_test.go | ||
deployment_test.go | ||
doc.go | ||
import.go | ||
import_test.go | ||
manifest.go | ||
manifest_test.go | ||
plan.go | ||
plan_test.go | ||
snapshot.go | ||
snapshot_test.go | ||
source.go | ||
source_error.go | ||
source_error_test.go | ||
source_eval.go | ||
source_eval_test.go | ||
source_null.go | ||
source_query.go | ||
source_query_test.go | ||
state_builder.go | ||
state_builder_test.go | ||
step.go | ||
step_executor.go | ||
step_executor_test.go | ||
step_generator.go | ||
step_generator_test.go | ||
step_test.go | ||
target.go | ||
target_test.go |