command/init: include config loader diagnostics in output (#24921)

Previously the diagnostics from the config loaders (earlyconfig and
regular) were only appended to the overall diags if an error was found.
This adds all diagnostics from the regular config loader so that any
generated warnings will be displayed, even if there are no errors.

I did not add the `earlyconfig` warnings since they will be displayed if
there is an error and are likely to be duplicated by the config loader.
This commit is contained in:
Kristin Laemmert 2020-05-12 08:39:12 -04:00 committed by GitHub
parent 14985469b4
commit 862dc36884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,9 +213,9 @@ func (c *InitCommand) Run(args []string) int {
}
_, confDiags = c.loadConfig(path)
diags = diags.Append(confDiags)
if confDiags.HasErrors() {
c.Ui.Error(strings.TrimSpace(errInitConfigError))
diags = diags.Append(confDiags)
c.showDiagnostics(diags)
return 1
}