https://pulumi.com logo
#general
Title
# general
d

delightful-lizard-41466

11/11/2019, 3:35 PM
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

white-balloon-205

11/11/2019, 5:10 PM
Yes - StackReference is likely the best answer. What issues are you seeing?
d

delightful-lizard-41466

11/11/2019, 7:14 PM
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

white-balloon-205

11/11/2019, 10:17 PM
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

delightful-lizard-41466

11/12/2019, 8:44 AM
Thanks @white-balloon-205 I'll give a try today...