hi folks, I'm trying to invoke something AFTER a r...
# dotnet
n
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
n
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
I’m surprised the
Tuple
approach doesn’t work. Are you tupling a property that is unknown before deployment?
n
@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.