command/plan: output while refreshing since that can take awhile

This commit is contained in:
Mitchell Hashimoto 2014-07-12 17:17:03 -07:00
parent f085ae65fa
commit b4b116a018
2 changed files with 6 additions and 2 deletions

View File

@ -72,7 +72,7 @@ func (h *UiHook) PreApply(
} }
h.ui.Output(h.Colorize.Color(fmt.Sprintf( h.ui.Output(h.Colorize.Color(fmt.Sprintf(
"[bold]%s: %s[reset_bold]\n %s", "[reset][bold]%s: %s[reset_bold]\n %s",
id, id,
operation, operation,
strings.TrimSpace(attrBuf.String())))) strings.TrimSpace(attrBuf.String()))))
@ -89,7 +89,9 @@ func (h *UiHook) PreRefresh(
id string, s *terraform.ResourceState) (terraform.HookAction, error) { id string, s *terraform.ResourceState) (terraform.HookAction, error) {
h.once.Do(h.init) h.once.Do(h.init)
//h.ui.Output(fmt.Sprintf("%s: Refreshing state (ID: %s)", id, s.ID)) h.ui.Output(h.Colorize.Color(fmt.Sprintf(
"[reset][bold]%s: Refreshing (ID: %s)",
id, s.ID)))
return terraform.HookActionContinue, nil return terraform.HookActionContinue, nil
} }

View File

@ -92,10 +92,12 @@ func (c *PlanCommand) Run(args []string) int {
} }
if refresh { if refresh {
c.Ui.Output("Refreshing Terraform state prior to plan...\n")
if _, err := ctx.Refresh(); err != nil { if _, err := ctx.Refresh(); err != nil {
c.Ui.Error(fmt.Sprintf("Error refreshing state: %s", err)) c.Ui.Error(fmt.Sprintf("Error refreshing state: %s", err))
return 1 return 1
} }
c.Ui.Output("")
} }
plan, err := ctx.Plan(&terraform.PlanOpts{Destroy: destroy}) plan, err := ctx.Plan(&terraform.PlanOpts{Destroy: destroy})