Skip to content

Commit

Permalink
Merge pull request #25013 from hashicorp/alisdair/ui-data-source-read
Browse files Browse the repository at this point in the history
command: Add UI hooks for read actions
  • Loading branch information
alisdair committed May 26, 2020
2 parents c9fcdbc + 841ff59 commit 5d0b75d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions command/hook_ui.go
Expand Up @@ -60,6 +60,7 @@ const (
uiResourceCreate
uiResourceModify
uiResourceDestroy
uiResourceRead
)

func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (terraform.HookAction, error) {
Expand All @@ -83,6 +84,9 @@ func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation,
case plans.Update:
operation = "Modifying..."
op = uiResourceModify
case plans.Read:
operation = "Reading..."
op = uiResourceRead
default:
// We don't expect any other actions in here, so anything else is a
// bug in the caller but we'll ignore it in order to be robust.
Expand Down Expand Up @@ -196,6 +200,8 @@ func (h *UiHook) stillApplying(state uiResourceState) {
msg = "Still destroying..."
case uiResourceCreate:
msg = "Still creating..."
case uiResourceRead:
msg = "Still reading..."
case uiResourceUnknown:
return
}
Expand Down Expand Up @@ -241,6 +247,8 @@ func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation
msg = "Destruction complete"
case uiResourceCreate:
msg = "Creation complete"
case uiResourceRead:
msg = "Read complete"
case uiResourceUnknown:
return terraform.HookActionContinue, nil
}
Expand Down

0 comments on commit 5d0b75d

Please sign in to comment.