From d0f50ff83fedc94554279d56b61d86485308eb36 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Thu, 14 Nov 2019 14:33:43 -0800 Subject: [PATCH] command: Don't treat config warnings as errors Meta.backendConfig was incorrectly treating the second return value from loadBackendConfig as if it were go "error" rather than tfdiags.Diagnostics, which in turn meant that it would treat warnings like errors. This had confusing results because it still returned that tfdiags.Diagnostics value in its own diagnostics return value, causing the caller to see warnings even though the backendConfig function had taken the error codepath. --- command/meta_backend.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/command/meta_backend.go b/command/meta_backend.go index 3a0cc473e..bf0dc657a 100644 --- a/command/meta_backend.go +++ b/command/meta_backend.go @@ -346,9 +346,10 @@ func (m *Meta) backendConfig(opts *BackendOpts) (*configs.Backend, int, tfdiags. if opts.Config == nil { // check if the config was missing, or just not required - conf, err := m.loadBackendConfig(".") - if err != nil { - return nil, 0, err + conf, moreDiags := m.loadBackendConfig(".") + diags = diags.Append(moreDiags) + if moreDiags.HasErrors() { + return nil, 0, diags } if conf == nil {