Anyone know how I can get a reference to a resourc...
# getting-started
h
Anyone know how I can get a reference to a resource created in another stack? I have the resource name as an output (in this case an Azure Native SQL Server). The Azure Native SQL package exposes a
getServer
method but this returns a
GetServerResult
which does not extend
Resource
so cannot be passed to the parent property of another resource - as opposed to the
Server
type which you get if you create one in the same flow.
Would be enough to just pass the URN ang getProvider to the parent like so
Copy code
new sql.Database(
    name,
    {
       //args
    },
    {
        parent: {
            urn: server.urn,
            getProvider: server.getProvider
        }
    }
)
Still asks the question of how I get this information?
Actually considering the graph view in the portal maybe what I'm trying to do doesn't make sense - perhaps you can't have a parent of a resource be a resource from another stack?