From 5d27a5b3e25968e5ad1dd260dd8b03fd484f020b Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Sat, 7 May 2016 23:51:55 -0700 Subject: [PATCH] command: Show id only when refreshing managed resources 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. --- command/hook_ui.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/command/hook_ui.go b/command/hook_ui.go index e1cb052859..736dd39145 100644 --- a/command/hook_ui.go +++ b/command/hook_ui.go @@ -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 }