https://pulumi.com logo
#dotnet
Title
# dotnet
n

numerous-artist-1705

08/05/2020, 9:59 AM
hi folks, I'm trying to invoke something AFTER a resource gets created. I'm using
resource.Property.Apply(x => do something with x)
, but "do something with x" gets invoked BEFORE the resource creation (I presume as the property is the name and it's available upfront). I tried adding other properties with
Output.Tuple
, but it seems that, as the name is ready it will be always invoked immediately. Is there a way to wait for the resource to be created to execute some other code? Thanks
s

sticky-jordan-27156

08/05/2020, 5:40 PM
n

numerous-artist-1705

08/06/2020, 7:46 AM
thanks @sticky-jordan-27156, but the
GetServicePrincipal.InvokeAsync
does not have an overload accepting
CustomResourceOptions
. The workaround could be (not sure if it works) to create a dummy custom resource that depends on the function and use something on its ID output to invoke the get; that would be really awful and I'm not sure it would work as probably also that ID would be known upfront.
t

tall-librarian-49374

08/06/2020, 8:13 AM
I’m surprised the
Tuple
approach doesn’t work. Are you tupling a property that is unknown before deployment?
n

numerous-artist-1705

08/06/2020, 8:41 AM
@tall-librarian-49374 I just did that and it worked, I was using function.Identity and also tried Urn in the tuple with no success, but I then switched to
Id
as that is surely provided by Azure and it worked. It's still a bit hacky and I'm not sure it will work in all cases, but it's good enough for now.