mirror of https://github.com/pulumi/pulumi.git
37caaba2ff
External resources are resources whose state is tracked but not managed. That is, they feature in the state file, but Pulumi does not issue create, read or update operations for them. Typically they arise as the result of generated `.get` functions and methods in Pulumi programs (these should not be confused with specific `getX` functions/methods, which are backed by `Invoke`s and designed to reflect data sources/arbitrary function calls). In #16146, `refresh` operations were modified to use actual bonafide `Diff` calls to compute differences in a manner that would reflect "what will happen on the next `preview`". In general, this aligns better with what users expect when running `refresh`, and fixes a number of issues that have long plagued `refresh`. However, it falls down in the case of external resources. The existing `Diff` contract takes (somewhat strangely) _three_ key inputs: * The old inputs ("what the program used to say") * The old outputs ("what we got back from the last update") * The new inputs ("what the program says now") Intuitively, `Diff`'s job is to return the difference between the old and new inputs. Aside from old outputs being a bit of a third wheel, this contract makes sense for an `update` operation, where the inputs are driving the outputs and changes there will yield changes elsewhere. In a `refresh` operation, however, we have a different situation -- one in which _both_ old and new inputs _and_ outputs are available. Alas, we don't currently have a "four-argument `Diff`" (or a two-argument one we can call twice with no fear of repercussions), and so the usage in `refresh` is a little bit of a clever hack that ends up biasing inputs over outputs (see #16146 or the implementation for details). For external resources, the old behaviour (where we just compared outputs) seems like a better fit. This commit therefore adds this special case and a test to ensure that when we see external resources, we simply compare outputs and don't call `Diff`. Fixes #16401 Fixes #16502 --------- Co-authored-by: Thomas Gummerer <t.gummerer@gmail.com> |
||
---|---|---|
.. | ||
0-0-0 | ||
1-0-0 |