-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print pending actions during apply and destroy #6032
Conversation
Caveats: There are no tests (are there tests anywhere of UiHook?) and the timeout is not configurable (would anyone want to configure it?). |
I suppose it might be cleaner to do this as a separate Hook from UiHook... Thoughts? |
ff8dffc
to
50ed916
Compare
I updated this to be a separate hook, which seemed cleaner. If it's important that UiHook know that its Ui is concurrent, maybe it can do some sort of type check? By the way, while testing this, I noticed that sometimes the last few "Destruction complete" messages didn't appear and the countHook "destroyed" count was too low! I don't think this could be caused by this change, though... |
Looking into test failure. |
50ed916
to
b74a8dc
Compare
Resolved test failure. |
} else { | ||
// PreApply. | ||
if _, found := idToOp[event.id]; found { | ||
panic(fmt.Sprintf("got duplicate PreApply for %s", event.id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out this panic can fire. Working on an updated version which refcounts calls to Pre/PostApply.
b74a8dc
to
ade9d9e
Compare
During `apply` and `destroy` commands, prints the current set of resources if no apply step has started or stopped within ten seconds. Fixes hashicorp#5932. Note: this removes the wrapping of UiHook.Ui in a ConcurrentUi, because it appears that it is already a ConcurrentUi when constructed in Meta anyway. Since there are now two hooks that share the Ui, what's important is that the underlying Ui passed to both hooks is concurrent; the fact that UiHook's is itself concurrent is distracting.
ade9d9e
to
f88f0f9
Compare
Fixed panic issue with refcounting. |
Hey @glasser thanks! I completely missed this and ended up duplicating your work in #6162. I went the route of modifying UIHook to show pending resources when nothing has happened to a specific resource for a period of time. There aren't any tests for the UI hook, probably one of the only non-tested areas of Terraform. :) I like the decisions you made with yours but lets go with the more naive and simple approach with #6162 and see how that goes. Sorry! |
I learned a lot about Terraform writing this, so no hard feelings. And yours is definitely a lot simpler! One thing I discovered playing around with this, FYI: I definitely saw a bunch of cases where PostApply didn't seem to be called consistently at the end of an apply! I especially saw this on things like
None of those 9 operations get a |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
During
apply
anddestroy
commands, prints the current set ofresources if no apply step has started or stopped within ten seconds.
Fixes #5932.