Skip to content

Commit

Permalink
command: Show id only when refreshing managed resources
Browse files Browse the repository at this point in the history
Data resources don't have ids when they refresh, so we'll skip showing the
"(ID: ...)"  indicator for these. Showing it with no id makes it look
like something is broken.
  • Loading branch information
apparentlymart committed May 8, 2016
1 parent 9bd92e7 commit 87475f1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions command/hook_ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,17 @@ func (h *UiHook) PreRefresh(
h.once.Do(h.init)

id := n.HumanId()

var stateIdSuffix string
// Data resources refresh before they have ids, whereas managed
// resources are only refreshed when they have ids.
if s.ID != "" {
stateIdSuffix = fmt.Sprintf(" (ID: %s)", s.ID)
}

h.ui.Output(h.Colorize.Color(fmt.Sprintf(
"[reset][bold]%s: Refreshing state... (ID: %s)",
id, s.ID)))
"[reset][bold]%s: Refreshing state...%s",
id, stateIdSuffix)))
return terraform.HookActionContinue, nil
}

Expand Down

0 comments on commit 87475f1

Please sign in to comment.