diff --git a/command/cli_ui.go b/command/cli_ui.go index b9fc23556..d9016db03 100644 --- a/command/cli_ui.go +++ b/command/cli_ui.go @@ -14,6 +14,7 @@ type ColorizeUi struct { OutputColor string InfoColor string ErrorColor string + WarnColor string Ui cli.Ui } @@ -33,6 +34,10 @@ func (u *ColorizeUi) Error(message string) { u.Ui.Error(u.colorize(message, u.ErrorColor)) } +func (u *ColorizeUi) Warn(message string) { + u.Ui.Warn(u.colorize(message, u.WarnColor)) +} + func (u *ColorizeUi) colorize(message string, color string) string { if color == "" { return message diff --git a/command/command.go b/command/command.go index 7779a64bf..c42313b3b 100644 --- a/command/command.go +++ b/command/command.go @@ -33,9 +33,9 @@ func validateContext(ctx *terraform.Context, ui cli.Ui) bool { "fix these before continuing.\n") if len(ws) > 0 { - ui.Output("Warnings:\n") + ui.Warn("Warnings:\n") for _, w := range ws { - ui.Output(fmt.Sprintf(" * %s", w)) + ui.Warn(fmt.Sprintf(" * %s", w)) } if len(es) > 0 { @@ -44,13 +44,16 @@ func validateContext(ctx *terraform.Context, ui cli.Ui) bool { } if len(es) > 0 { - ui.Output("Errors:\n") + ui.Error("Errors:\n") for _, e := range es { - ui.Output(fmt.Sprintf(" * %s", e)) + ui.Error(fmt.Sprintf(" * %s", e)) } + return false + } else { + ui.Warn(fmt.Sprintf("\n"+ + "No errors found. Continuing with %d warning(s).\n", len(ws))) + return true } - - return false } return true diff --git a/command/meta.go b/command/meta.go index 4745ef6a1..7cf3ebe05 100644 --- a/command/meta.go +++ b/command/meta.go @@ -331,6 +331,7 @@ func (m *Meta) process(args []string, vars bool) []string { Ui: &ColorizeUi{ Colorize: m.Colorize(), ErrorColor: "[red]", + WarnColor: "[yellow]", Ui: m.oldUi, }, }