stacks: skip resource instance hooks during refresh plans #37043
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During Stacks destroy operations each component does a refresh operation before calling destroy. This was actually causing the number of resources to be double-counted by the stacks progress events as the refresh operation was triggering the pre- and post- diff hooks to be counted by Stacks.
This PR updates the stacks component planning so the hook implementations are taken out of the code shared by the refresh and planning operations, and are instead called directly by the stack graph nodes where they are needed. This ensures the destroy-refresh operation doesn't emit status updates for resources anymore.
I've added a big testing helper function to help test the stacks hooks implementation, and added a test that uses it to expose the problem fixed here. Because most of the tests share the same core testing code, this implementation does also ensure that many additional tests are also validating the hooks process is adding things in the right order even if they're not all directly validating the exact hooks that are being called.