broad-dog-22463
03/09/2021, 3:24 PMtall-librarian-49374
03/09/2021, 3:27 PMbroad-dog-22463
03/09/2021, 3:38 PMworried-knife-31967
03/09/2021, 3:42 PMgot 5
and that's intermittent.tall-librarian-49374
03/09/2021, 4:07 PMbored-oyster-3147
03/09/2021, 4:07 PMworried-knife-31967
03/09/2021, 4:13 PMtall-librarian-49374
03/09/2021, 4:15 PMKey
to stack outputs?base.RegisterOutputs(new Dictionary<string, object?> { { "Key", Key }});
bored-oyster-3147
03/09/2021, 4:20 PMgot 5
, but it's throwing me off a little bit that line 61 of the gist is assigning to this.Key
when the constructor already did thatworried-knife-31967
03/09/2021, 4:47 PMbored-oyster-3147
03/09/2021, 4:49 PMRegisterOutputs
internally adds the task to a collection of tasks to be awaited. the issue before was your task wasn't being awaited so the program was exitting before it could finish.
Also when you pass CreateAsync
that task starts running immediately, which is why you are seeing it run before you applyworried-knife-31967
03/09/2021, 4:54 PMbored-oyster-3147
03/09/2021, 4:58 PMIsDryRun
will do that for youtall-librarian-49374
03/09/2021, 5:01 PMworried-knife-31967
03/09/2021, 5:02 PMpulumi up
bored-oyster-3147
03/09/2021, 5:07 PMdynamic provider
which would handle not creating if it already exists, updating it, etc.. unfortunately not supported in .NET right now
ComponentResource
is mostly meant to be used to encapsulate the deployment of a logical grouping of cloud resources. But you're trying to give pulumi the ability to manage/provision a custom resource (your function key) so you want a providertall-librarian-49374
03/09/2021, 5:21 PMworried-knife-31967
03/09/2021, 5:25 PMif (Pulumi.Deployment.Instance.IsDryRun)
{
var dryRunResponse = await httpClient.GetAsync(new Uri($"/admin/host/keys/{keyName}", UriKind.Relative));
if (dryRunResponse.IsSuccessStatusCode)
{
var getkeyresponse = JsonSerializer.Deserialize<GetKeyResponse>(await dryRunResponse.Content.ReadAsStringAsync());
if (keyValue == getkeyresponse.Value)
return keyValue;
}
return "";
}
CustomResource
was what was required for this... Dynamic Provider might be the one I suppose.
I'm happy to put some effort into it...
I'm going to drop that solution into a blog later as it's required for getting functions into an Azure API Manager.broad-dog-22463
03/09/2021, 6:09 PM