mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-23 23:50:12 -06:00
cb2e9119aa
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
31 lines
892 B
Go
31 lines
892 B
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package tofu
|
|
|
|
import (
|
|
"github.com/opentofu/opentofu/internal/tfdiags"
|
|
|
|
"github.com/opentofu/opentofu/internal/configs"
|
|
)
|
|
|
|
// CheckCoreVersionRequirements visits each of the modules in the given
|
|
// configuration tree and verifies that any given Core version constraints
|
|
// match with the version of OpenTofu Core that is being used.
|
|
//
|
|
// The returned diagnostics will contain errors if any constraints do not match.
|
|
// The returned diagnostics might also return warnings, which should be
|
|
// displayed to the user.
|
|
func CheckCoreVersionRequirements(config *configs.Config) tfdiags.Diagnostics {
|
|
if config == nil {
|
|
return nil
|
|
}
|
|
|
|
var diags tfdiags.Diagnostics
|
|
diags = diags.Append(config.CheckCoreVersionRequirements())
|
|
|
|
return diags
|
|
}
|