mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
command: show warnings from backend config validation
Previously we just silently ignored warnings from validating the backend config, but now that we have a deprecated argument it's important to print these out so users can respond to the deprecation warning.
This commit is contained in:
parent
5026e1d313
commit
5f9f13ab8f
@ -1341,14 +1341,18 @@ func (m *Meta) backendInitFromConfig(c *config.Backend) (backend.Backend, error)
|
|||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
warns, errs := b.Validate(config)
|
warns, errs := b.Validate(config)
|
||||||
|
for _, warning := range warns {
|
||||||
|
// We just write warnings directly to the UI. This isn't great
|
||||||
|
// since we're a bit deep here to be pushing stuff out into the
|
||||||
|
// UI, but sufficient to let us print out deprecation warnings
|
||||||
|
// and the like.
|
||||||
|
m.Ui.Warn(warning)
|
||||||
|
}
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
return nil, fmt.Errorf(
|
return nil, fmt.Errorf(
|
||||||
"Error configuring the backend %q: %s",
|
"Error configuring the backend %q: %s",
|
||||||
c.Type, multierror.Append(nil, errs...))
|
c.Type, multierror.Append(nil, errs...))
|
||||||
}
|
}
|
||||||
if len(warns) > 0 {
|
|
||||||
// TODO: warnings are currently ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure
|
// Configure
|
||||||
if err := b.Configure(config); err != nil {
|
if err := b.Configure(config); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user