https://pulumi.com logo
#azure
Title
# azure
e

elegant-balloon-59607

02/18/2020, 4:03 PM
Hey! Would like to know what's the best way to share information between multiple stacks. In my
dev
stack I create a CosmosDB, get the connection string, and then create a new AppService using the connection string. Then in my
tests
stack I would like to create a new AppService (in a different resource group but same subscription) and also reference the CosmosDB connection string from
dev
. Here's a beautiful drawing showing it. :D
b

better-rainbow-14549

02/18/2020, 4:17 PM
use the getX() function and give it the name and resourcegroup and it will retrieve the details
like azure.cosmos.getAccount()
then you can access the other properties it's read from azure
g

gentle-diamond-70147

02/18/2020, 4:27 PM
b

better-rainbow-14549

02/18/2020, 4:28 PM
is it possible to use StackReference if you use pulumi with local logins instead of cloud
e

elegant-balloon-59607

02/18/2020, 4:30 PM
@better-rainbow-14549 To use the GetX() function, I need the resource-name and the id, right? How I could get the Id in runtime?
b

better-rainbow-14549

02/18/2020, 4:31 PM
no you don't need the ID
azure.cosmosdb.getAccount({ name: "mycosmos", resourceGroup: "myresourcegroup" })
e

elegant-balloon-59607

02/18/2020, 4:32 PM
@gentle-diamond-70147 Was trying to avoid using it because currently triyng the C# lib and it doesn't seems to be available, but if necessary going to try other library
g

gentle-diamond-70147

02/18/2020, 4:32 PM
StackReference is available in C# I believe and should work with local logins.
e

elegant-balloon-59607

02/18/2020, 4:34 PM
@better-rainbow-14549 Can't find something like that in the C# lib tho.
@gentle-diamond-70147 Cool, going to take a look! 🙂 thanks
b

better-rainbow-14549

02/18/2020, 4:37 PM
x.get() take the ID and are used internally by pulumi, but cosmos.getAccount() is separate (it exists in the nodejs package anyway)
👍 1
6 Views