This message was deleted.
# python
s
This message was deleted.
r
Dynamic provider code:
Copy code
import binascii
import os
from typing import Optional

from pulumi import ResourceOptions
from pulumi.dynamic import CreateResult, Resource, ResourceProvider


class RandomProvider(ResourceProvider):
    def create(self, inputs):
        return CreateResult(id_=binascii.b2a_hex(os.urandom(16)), outs={})


class Random(Resource):
    def __init__(self, name: str, opts: Optional[ResourceOptions] = None):
        super().__init__(RandomProvider(), name, {}, opts)


my_resource = Random("foo")
Information from `pulumi about`:
Copy code
CLI
Version      3.48.0
Go Version   go1.19.2
Go Compiler  gc

Plugins
NAME           VERSION
gcp            6.44.0
google-native  0.27.0
python         unknown

Host
OS       darwin
Version  13.0
Arch     arm64

<...stack resources>

Dependencies:
NAME                      VERSION
google-cloud-bigquery     3.4.0
google-cloud-datacatalog  3.9.3
grpcio-status             1.47.0
pip                       22.3.1
pulumi-gcp                6.44.0
pulumi-google-native      0.27.0
schema                    0.7.5
setuptools                65.5.1
wheel                     0.37.1
I've also tried it in a fresh python 3.9.14 environment with the same result. And I tried this: https://github.com/grpc/grpc/issues/29262#issuecomment-1142667300 without any luck
So this appeared to be a problem with using DynamicProvider outside the
__main__.py
file. https://github.com/pulumi/pulumi/issues/7453
s
i'm not sure that issue applies in this scenario. I am able to use a DynamicProvider outside of main, but I do get the same error you are seeing whenever I use an async api call within create method
Copy code
class ManagedVNetProvider(ResourceProvider):
    def create(self, props):
        client_config = pulumi_azure_native.authorization.get_client_config()
due to the
get_client_config()
call i see the exact error as you. when i take it out, the resource provider works fine
Copy code
.../lib/python3.10/site-packages/grpc/_server.py:456: RuntimeWarning: coroutine 'invoke.<locals>.do_rpc' was never awaited