I need to create a resource (B) only after another...
# general
c
I need to create a resource (B) only after another resource (A) has been physically created. (B) depends on an API call being made to (A) to grab some auto-generated credentials using the Azure API. I'm using Output.Tuple(resourceA.Name, ...) during the creation of (B), but I must be misunderstanding the timing here.
b
if there are outputs from resource (A) that are passed to resource (B) then it should work. you can also pass a resource option for
dependsOn
https://www.pulumi.com/docs/intro/concepts/resources/#dependson do either of those options help?
c
I tried the DependsOn - same thing happened. I suspect I'm just doing something... weird. Here's the a gist of what I'm tryin to do - https://gist.github.com/pfsscott/2499a1d69c8acb364d49ef52971990e6
Maybe easier to understand would be
Output.Tuple(resourceGroup.Name, publicWeb.Name).Apply(async t => await GetAppServiceIpAddress(t.Item1, t.Item2))
, where `GetAppServiceIpAddress`fails in the same way - the Azure App Service hasn't been created yet, so the call fails.
For now I'm having to run
pulumi up
twice. Once to get the app spun up, then I
pulumi config set configureWebJobs true
, then another
pulumi up
to build the rest. Not great, but it works.
b
hmm, I can't see an obvious reason that doesn't work. which resource is it?
c
In my gist, the
CreateRecurringTriggeredWebJobWorkflow
creates a
AzureNative.Logic.Workflow
resource. That resource depends on a
AzureNative.WebApp.WebApp
my second example is just an output assignment:
this.WebsiteInboundIpAddressForARecord = Output.Tuple(resourceGroup.Name, publicWeb.Name).Apply(async t => await GetAppServiceIpAddress(t.Item1, t.Item2));
Both rely on the WebApp being physically created.