wet-noon-14291
05/05/2021, 2:06 PMbored-oyster-3147
05/05/2021, 2:12 PM.apply(...)
in your scenario.
To clarify, and somebody correct me if I'm wrong, but you asked:
Will it resolve when the property has a value or will it resolve when the resource is ready?I don't believe any of those output properties will have a value until the resource is ready. At the very least, the `Output<T>`s provided by a given resource contain information such that when they are passed into the
Input<T>
of another resource that resource is made aware that it depends on the previous, and must wait for it to be provisioned..apply(...)
to transform the value like using a Promise.then(...)
to transform the return value of a promisewet-noon-14291
05/05/2021, 2:28 PMA.apply
or something, that is, on the resource and not on the properties... I'll try and see how it goes.
With that said, reading this I get a little bit confused:
During some program executions, apply doesn’t run. For example, it won’t run during a preview, when resource output values may be unknown. Therefore, you should avoid side-effects within the callbacks. For this reason, you should not allocate new resources inside of your callbacks either, as it could lead to pulumi preview being wrong. - https://www.pulumi.com/docs/intro/concepts/inputs-outputs/#applyDoes this mean that if I have a change in the result from 2 (see flow above) it won't be recognized during preview?
apply
works as in the link, how would a change be recognized if the only change to a resource comes from an apply statement.bored-oyster-3147
05/05/2021, 2:36 PMWhat I would like to have though isI don't think this is necessary, because like I said, theor something, that is, on the resource and not on the propertiesA.apply
Output<T>
contains information detailing what Resource it came from so that pulumi is able to build your dependency tree implicitly.Does this mean that if I have a change in the result from 2 (see flow above) it won't be recognized during preview?If neither resources are deployed yet, pulumi preview would recognize that: • Resource A will be provisioned • Resource B will be provisioned • Resource B depends on Resource A If all or some of those resources are already provisioned, than pulumi preview logic is a little more complex and utilizes your current state in order to calculate changes
wet-noon-14291
05/05/2021, 4:27 PMlittle-cartoon-10569
05/05/2021, 9:00 PM.apply
returns an output:
const a = new A("a", {});
const b = new B("b", {
y: a.y.apply(y => doExtraWork(y)
});