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

wet-noon-14291

02/16/2021, 11:29 AM
Let's say I want to do something after a resource to get a value that is input to another resource, how do I achieve that? Do I do something like:
Copy code
var someVal = resource1.Id.Apply(id => { return GetSomeValue(); });
var resource2 = new SomeResource("name", SomeArgs({AValue = someVal}));
Am I guaranteed that
someVal
will "resolve" after
resource1
is done or is there another way to do this?
t

tall-librarian-49374

02/16/2021, 11:32 AM
If you
Apply
on a property that is resolved only after the resource is created, this should work
w

wet-noon-14291

02/16/2021, 11:40 AM
ok, but is there a more pulumi "idiomatic" way of doing it? Ideally I would like to say something like:
Copy code
var someVal = resource1.AfterDeploy(...);
To be even more concrete. What I would like to do is make a request to a kubernetes app after it has been deployed and then use the response I get as input to another resource (APIM). We are still struggling with some weird 502/503 errors from APIM to kubernetes when APIM is fetching the openapi spec. What we would like to try is that we fetch the open api spec and provide it to the APIM resource so APIM doesn't have to make any request. This way we can have error handling on the 502/503 error in our pulumi code.