<@U02J3T6A8LB> and guys, could you help me share e...
# general
c
@echoing-dinner-19531 and guys, could you help me share example of get id of an existing Dynamic Resource Provider? currently I’m trying
WorkspaceMember.get()
but it return error
Copy code
Cannot access member "get" for type "type[WorkspaceMember]" Member "get" is unknownPylancereportAttributeAccessIssue (function) get: Unknown
e
I don't think get works for dynamic resources
c
;(
e
There's no
read
method on dynamic providers for the engine to lookup a resource with
c
let me explain my context: currently we want assign
member
into a
Project
, we want Project depend on member to make sure member is created before Project create
e
Just use a depends_on property?
c
yes, but I don’t know how to pass depends_on property, that’s why I’m looking on
get
function
Copy code
pulumi:pulumi:Stack                   pulum-bytebase                   **failed**              1 error; 42 messages
     ├─ pulumi-python:dynamic:Resource     Project_A                                                      
 +   │  └─ pulumi-python:dynamic:Resource  ProjectMember_A                        **creating failed**     1 error
 +   ├─ pulumi-python:dynamic:Resource     <mailto:WorkspaceMember_a@example.com|WorkspaceMember_a@example.com>  created (0.56s)         
 +   └─ pulumi-python:dynamic:Resource     <mailto:WorkspaceMember_b@example.com|WorkspaceMember_b@example.com>     created (1s)
as above, the WorkspaceMember_* is in a Dynamic Provider, and ProjectMember is another Provider
and Workspace member can be passed into multiple Project
e
So pass the member resources to the Project_A depends_on option
c
Copy code
if workspace_members:
                for member in set(workspace_members):
                    response = WorkspaceMember(f"{member}", {"users": member})
the currently Python code look like that, I think the
response
only available for
create
user as pulumi output above, only resource of a & b@example.com will be returned. Did I understand right?
in case I want to pass
<mailto:c@example.com|c@example.com>
which created before as depend_on for Porject A, what should I do?
e
ah... yeh that's not supported. Again there's no
read
for dynamic providers
c
, we want Project depend on member to make sure member is created before Project create
then do you have any suggestion or other approach for this case? 🥲
like control the order of resource creation to allow WorkspaceMember create before Project
e
well given c must be a resource that's being created elsewhere just write the code in your program to check if it exists and if it doesn't exit out?
c
I see 2 points: • the current approach is combine members from projects into one unique list to perform
WorkspaceMember
, because of an user can be member of multiple project. it’ll help save API call with unique list • your approach is check user exist on every project’s member section, it’ll have duplicated call as user belong to multiple project. it still work but it’s not a good approach. too waste api call and need more time to go through all members
e
yeh but I think given the limits of dynamic providers here its tricky to unify this in one way
c
;( do we have any plan to add
read
function for Dynamic Provider 😄
e
Nothing on the roadmap for it
Probably doable, but haven't heard any plans for it