https://pulumi.com logo
Title
b

better-eve-93881

11/30/2022, 10:20 AM
Hi, i am trying to create a ComponentResource that also makes sure that certain Roles exists (on alicloud). The issue is that if one stack creates them they will already be available for the other stacks. Is there a way to only create them once within a ComponentResource? Or to check if they exists via the data resource and if they don't exist only then create them within a ComponentResource. The issue is that the constructor is not async. And there is nothing like dependsOn, which waits for an Output to then decide if this needs to be created or not.
nvm, i found the issues related to this https://github.com/pulumi/pulumi/issues/3388 ...
l

little-cartoon-10569

11/30/2022, 7:31 PM
That issue seems wrong to me. It is not needed. Use StackReferences. Your project are not stand-alone: if one project depends on having upped another project previously, then "create if doesn't exist" isn't a problem: your dependency is "other project has been upped".
Just use StackReference and depend on the outputs of the other stack.