mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-05-15 22:00:38 -04:00
Move AllowExperimentalFeatures to arguments.System
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
This commit is contained in:
@@ -88,10 +88,11 @@ func initCommands(
|
||||
WorkingDir: wd,
|
||||
View: view.SetRunningInAutomation(inAutomation),
|
||||
SystemArgs: arguments.System{
|
||||
RunningInAutomation: inAutomation,
|
||||
CLIConfigDir: configDir,
|
||||
PluginCacheDir: config.PluginCacheDir,
|
||||
GlobalPluginDirs: globalPluginDirs(),
|
||||
RunningInAutomation: inAutomation,
|
||||
CLIConfigDir: configDir,
|
||||
PluginCacheDir: config.PluginCacheDir,
|
||||
GlobalPluginDirs: globalPluginDirs(),
|
||||
AllowExperimentalFeatures: experimentsAreAllowed(),
|
||||
},
|
||||
|
||||
Services: services,
|
||||
@@ -113,8 +114,6 @@ func initCommands(
|
||||
ProviderDevOverrides: providerDevOverrides,
|
||||
UnmanagedProviders: unmanagedProviders,
|
||||
|
||||
AllowExperimentalFeatures: experimentsAreAllowed(),
|
||||
|
||||
// ProviderSourceLocationConfig is used for some commands that do not make
|
||||
// use of the OpenTofu configuration files. Therefore, there is no way to configure
|
||||
// the retries from other places than env vars.
|
||||
|
||||
@@ -28,4 +28,18 @@ type System struct {
|
||||
|
||||
// GlobalPluginDirs contains additional paths to search for plugins
|
||||
GlobalPluginDirs []string
|
||||
|
||||
// AllowExperimentalFeatures controls whether the current build of OpenTofu
|
||||
// has experimental features enabled.
|
||||
//
|
||||
// In normal code this would be set by package main only in builds
|
||||
// explicitly marked as being alpha releases or development snapshots,
|
||||
// making experimental features unavailable otherwise. Test code may
|
||||
// choose to set this if it needs to exercise experimental features.
|
||||
//
|
||||
// Some experiments predated the addition of this setting, and may
|
||||
// therefore still be available even if this flag is false. Our intent
|
||||
// is that all/most _future_ experiments will be unavailable unless this
|
||||
// flag is set, to reinforce that experiments are not for production use.
|
||||
AllowExperimentalFeatures bool
|
||||
}
|
||||
|
||||
@@ -144,24 +144,6 @@ type Meta struct {
|
||||
// just trusting that someone else did it before running OpenTofu.
|
||||
UnmanagedProviders map[addrs.Provider]*plugin.ReattachConfig
|
||||
|
||||
// AllowExperimentalFeatures controls whether a command that embeds this
|
||||
// Meta is permitted to make use of experimental OpenTofu features.
|
||||
//
|
||||
// Set this field only during the initial creation of Meta. If you change
|
||||
// this field after calling methods of type Meta then the resulting
|
||||
// behavior is undefined.
|
||||
//
|
||||
// In normal code this would be set by package main only in builds
|
||||
// explicitly marked as being alpha releases or development snapshots,
|
||||
// making experimental features unavailable otherwise. Test code may
|
||||
// choose to set this if it needs to exercise experimental features.
|
||||
//
|
||||
// Some experiments predated the addition of this setting, and may
|
||||
// therefore still be available even if this flag is false. Our intent
|
||||
// is that all/most _future_ experiments will be unavailable unless this
|
||||
// flag is set, to reinforce that experiments are not for production use.
|
||||
AllowExperimentalFeatures bool
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// Protected: commands can set these
|
||||
// ----------------------------------------------------------
|
||||
|
||||
@@ -109,7 +109,7 @@ func (m *Meta) Backend(ctx context.Context, opts *BackendOpts, enc encryption.St
|
||||
opts = &BackendOpts{}
|
||||
}
|
||||
|
||||
if m.AllowExperimentalFeatures {
|
||||
if m.SystemArgs.AllowExperimentalFeatures {
|
||||
// TEMP: While we're in early development of the new language runtime
|
||||
// we have an experimental shim to enable it using an environment
|
||||
// variable, but that's allowed only in builds where experimental
|
||||
@@ -327,7 +327,7 @@ func (m *Meta) selectWorkspace(ctx context.Context, b backend.Backend) error {
|
||||
func (m *Meta) BackendForLocalPlan(ctx context.Context, settings plans.Backend, enc encryption.StateEncryption) (backend.Enhanced, tfdiags.Diagnostics) {
|
||||
var diags tfdiags.Diagnostics
|
||||
|
||||
if m.AllowExperimentalFeatures {
|
||||
if m.SystemArgs.AllowExperimentalFeatures {
|
||||
// TEMP: While we're in early development of the new language runtime
|
||||
// we have an experimental shim to enable it using an environment
|
||||
// variable, but that's allowed only in builds where experimental
|
||||
|
||||
@@ -444,7 +444,7 @@ func (m *Meta) initConfigLoader() (*configload.Loader, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
loader.AllowLanguageExperiments(m.AllowExperimentalFeatures)
|
||||
loader.AllowLanguageExperiments(m.SystemArgs.AllowExperimentalFeatures)
|
||||
m.configLoader = loader
|
||||
if m.View != nil {
|
||||
m.View.SetConfigSources(loader.Sources)
|
||||
|
||||
Reference in New Issue
Block a user