Hi! Is there a proper way to reuse an "azure.stora...
# general
d
Hi! Is there a proper way to reuse an "azure.storage.Account" resource created by a previous Pulumi stack? I'm trying to use the StackReference but without success, suggestions ? Thanks
w
Yes - StackReference is likely the best answer. What issues are you seeing?
d
I can’t find any valid examples about it. Typically I use this code to create the storage:
const storageAccount = new azure.storage.Account(mystoragesa, {
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
accountTier: "Standard",
accountReplicationType: "LRS",
accountKind: "StorageV2"
});
But in the documentation below I can’t find the way to reference this storage in a different stack: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/azure/storage/#Account
w
There’s some examples for using StackReference here: https://www.pulumi.com/docs/intro/concepts/organizing-stacks-projects/
You should be able to export
storageAccount.name
and then read in that export from your other stack with StackReference.
d
Thanks @white-balloon-205 I'll give a try today...