PSS: Gate experimental logic behind feature flag (#37872)

This is a partial backport of #37868
pull/37870/head^2
Radek Simko 6 months ago committed by GitHub
parent b2c4a8ff07
commit 6fd75637df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -142,16 +142,28 @@ func (c *InitCommand) run(initArgs *arguments.Init, view views.Init) int {
return 1
}
if !c.Meta.AllowExperimentalFeatures && rootModEarly.StateStore != nil {
if !(c.Meta.AllowExperimentalFeatures && initArgs.EnablePssExperiment) && rootModEarly.StateStore != nil {
// TODO(SarahFrench/radeksimko) - remove when this feature isn't experimental.
// This approach for making the feature experimental is required
// to let us assert the feature is gated behind an experiment in tests.
// See https://github.com/hashicorp/terraform/pull/37350#issuecomment-3168555619
detail := "Pluggable state store is an experiment which requires"
if !c.Meta.AllowExperimentalFeatures {
detail += " an experimental build of terraform"
}
if !initArgs.EnablePssExperiment {
if !c.Meta.AllowExperimentalFeatures {
detail += " and"
}
detail += " -enable-pluggable-state-storage-experiment flag"
}
diags = diags.Append(earlyConfDiags)
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Unsupported block type",
Detail: "Blocks of type \"state_store\" are not expected here.",
Summary: "Pluggable state store experiment not supported",
Detail: detail,
Subject: &rootModEarly.StateStore.TypeRange,
})
view.Diagnostics(diags)

Loading…
Cancel
Save