-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Add UI Hooks for actions #37287
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
Add UI Hooks for actions #37287
Conversation
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.
I left some comments but they are more questions and possible ideas for future changes
return terraform.HookActionContinue, nil | ||
} | ||
|
||
func (h *jsonHook) StartAction(id terraform.HookActionIdentity) (terraform.HookAction, error) { |
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.
Not a PR comment, but this is making me wonder if users will expect lifecycle actions to be part of the resource progress bar 🤔
future ui thoughts!
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.
I think I would expect that, just because it's part of the resources lifecycle
return terraform.HookActionContinue, nil | ||
} | ||
|
||
func (h *UiHook) ProgressAction(id terraform.HookActionIdentity, progress string) (terraform.HookAction, error) { |
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.
Should we give actions a progress bar like resource have?
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.
How would that work, wouldn't the action need to report a percentage done back then?
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.
For a full progress bar, yeah. I was thinking in the context of streaming actions - we could display/return a "still working on it" heartbeat (none of this is relevant to the immediate PR!)
type ActionInvocation struct { | ||
TriggeringResource AbsResourceInstance | ||
Action AbsActionInstance | ||
TriggerIndex int |
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.
Since this is using absolute references, I'd name this something like AbsActionInvocation / ActionInvocationAbs/ whatever. And since you've got the trigger index in here, I'd even consider adding instance: AbsActionInvocationInstance. That name makes it much more obvious to other developers that this is referring to a single specific instance of an {Action & ActionTrigger}
For more context, I say this because at first I was going to point out that a given action could have multiple triggering resources, which is roughly when I realized that was the point of this struct, and we already have naming conventions that can be repurposed for this context!)
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.
Yeah that makes sense, I didn't consider all the other varieties of this to come 👍
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.
Looks like a good start!
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Adds UI Hooks that can be used during the action invocation to get progress messages from the action. The verbiage and format is not final, we can still adjust it later on.
Fixes TF-27253
Target Release
1.13.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry