green-country-86774
12/17/2020, 1:52 AMconst basic1 = new BasicResource("basic1", { value: "value1" })
const basic2 = new BasicResource("basic2", { value: "value2" }, { dependsOn: [basic1] })
I'm working on a dynamic resource and I was hoping to be able to run an update on basic2
when the value of basic1
changes. The use case I'm trying to address is rebuilding a search engine index if a facet value changes.clever-sunset-76585
12/17/2020, 2:10 AMdependsOn
. (EDIT: assuming basic1
changes somehow in order to trigger a change on its dependents.)
The other way, if you are interested (and slightly complicated), is to pass some input, that changes based on basic1
changing, to basic2
that you can then use in the diff
function of basic2
to compare and see if the value has changed. I forget the order of the DynamicResource
interface functions being called but you might find https://www.pulumi.com/blog/dynamic-providers/ helpful.green-country-86774
12/17/2020, 2:18 AMcheck
method is called every time but there doesn't seem to be any reference to the depend. I must be missing something small.pulumi up
. Then, update the value in basic1
to value2
and have that trigger the diff
method of the basic2
resources on the next pulumi up
.requiresRestart
property that I could use as an input to the other resource.clever-sunset-76585
12/17/2020, 5:55 PMIt looks like theYeahmethod is called every time but there doesn’t seem to be any reference to the dependcheck
check
is used to validate inputs and return errors if needed to stop execution. You can read more about the various interface functions here, in case you haven’t come across this doc already: https://www.pulumi.com/docs/intro/concepts/programming-model/#check-olds-news
diff
is where you can return an object that indicates whether a replacement/update is required based on some input changing.
t sounds like the simplest solution would be what you suggested and output something like aWhile using a boolean might work the first time (going fromproperty that I could use as an input to the other resource.requiresRestart
false
-> true
, it can only have one of two states. You could use some string output from basic1
that changes over time based on something else, which in turn could be used within the diff
function to compare old inputs with new inputs and therefore perform an update/replacement.diff
function determines which function the engine will call next. That is, if it should call the delete
, update
or create
function of your dynamic provider.