Question: when trying to create an Azure storage a...
# general
b
Question: when trying to create an Azure storage account, and then a container inside that account in the same pulumi stack, I get an error saying "account doesn't exist" on the storage/container first build. If I run it again right after, then the account exists and container will get built. Is there a "depends on" process or something similar, or should this be managed by Pulumi?
b
It depends. I assume you're doing something like:
Copy code
const a = new azure.storage.Account("my-account");
const c = new azure.storage.Container("my-container", {storageAccountName: a.name});
In this case, since you are taking a property of a resource (what we call an Output Property, and is typed as Output<string> in ts) and passing it as an "input" to another resource, Pulumi should detect the dependency there and wait until the account has been created before trying to create the container. If it doesn't that's a bug somewhere on our end, most likely. If you aren't passing the name property explicitly, then we can't auto-detect the dependency information. Every resource takes an opts parameter, and that parameter has a property called dependsOn which is a set of URNs that you depend on, if you need to add an explicit dependency.
b
ok thanks, I'll try the dependsOn, I did find that in the docs, I'll let you know if it functions as expected or if there's something else going on.
One more question, I noticed that when creating a azure.msi.UserAssignedIdentity and trying to output the
id
of that as an output, it delivered an Object, I figured it would be the full id to the resource. Using typescript. Is there a trick to get the full id, i.e. need to run it through a callback?
b
Yeah. If you have an Output, you have to use .apply() to get at the underlying value. Note that the code in the apply only runs when the value is “known”, so it may not always run during a preview (ie when you have not yet created the resource).
b
ok thanks, I'll try it out.. Also, the "dependsOn" worked when passing in the storage account to the container resource 👍