Remove sensitive_variables experiment
Ahead of the beta, remove the sensitive_variable experiment and update tests accordingly
This commit is contained in:
parent
6f4f6fbc72
commit
bc57c20d10
|
@ -1,7 +1,3 @@
|
|||
terraform {
|
||||
experiments = [sensitive_variables]
|
||||
}
|
||||
|
||||
variable "foo" {
|
||||
default = "bar"
|
||||
}
|
||||
|
|
|
@ -138,17 +138,6 @@ func checkModuleExperiments(m *Module) hcl.Diagnostics {
|
|||
}
|
||||
}
|
||||
*/
|
||||
if !m.ActiveExperiments.Has(experiments.SensitiveVariables) {
|
||||
for _, v := range m.Variables {
|
||||
if v.Sensitive {
|
||||
diags = diags.Append(&hcl.Diagnostic{
|
||||
Severity: hcl.DiagError,
|
||||
Summary: "Variable sensitivity is experimental",
|
||||
Detail: "This feature is currently an opt-in experiment, subject to change in future releases based on feedback.\n\nActivate the feature for this module by adding sensitive_variables to the list of active experiments.",
|
||||
Subject: v.DeclRange.Ptr(),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return diags
|
||||
}
|
||||
|
|
|
@ -260,12 +260,9 @@ func TestModuleOverrideSensitiveVariable(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
// TODO: When variable sensitivity is no longer experimental,
|
||||
// move this test folder to "valid-modules" (it currently has a warning)
|
||||
// and activate the diags assertion
|
||||
mod, _ := testModuleFromDir("testdata/warning-modules/override-variable")
|
||||
mod, diags := testModuleFromDir("testdata/valid-modules/override-variable-sensitive")
|
||||
|
||||
// assertNoDiagnostics(t, diags)
|
||||
assertNoDiagnostics(t, diags)
|
||||
|
||||
if mod == nil {
|
||||
t.Fatalf("module is nil")
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
terraform {
|
||||
experiments = [sensitive_variables]
|
||||
}
|
||||
|
||||
variable "sensitive-value" {
|
||||
sensitive = "123" # must be boolean
|
||||
}
|
||||
|
|
|
@ -22,3 +22,11 @@ variable "cheeze_pizza" {
|
|||
variable "π" {
|
||||
default = 3.14159265359
|
||||
}
|
||||
|
||||
variable "sensitive_value" {
|
||||
default = {
|
||||
"a" = 1,
|
||||
"b" = 2
|
||||
}
|
||||
sensitive = true
|
||||
}
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
terraform {
|
||||
experiments = [sensitive_variables]
|
||||
}
|
||||
|
||||
variable "false_true" {
|
||||
sensitive = false
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
terraform {
|
||||
experiments = [sensitive_variables] # WARNING: Experimental feature "sensitive_variables" is active
|
||||
}
|
||||
|
||||
variable "sensitive-value" {
|
||||
sensitive = true
|
||||
}
|
|
@ -14,14 +14,12 @@ type Experiment string
|
|||
// identifier so that it can be specified in configuration.
|
||||
const (
|
||||
VariableValidation = Experiment("variable_validation")
|
||||
SensitiveVariables = Experiment("sensitive_variables")
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Each experiment constant defined above must be registered here as either
|
||||
// a current or a concluded experiment.
|
||||
registerConcludedExperiment(VariableValidation, "Custom variable validation can now be used by default, without enabling an experiment.")
|
||||
registerCurrentExperiment(SensitiveVariables)
|
||||
}
|
||||
|
||||
// GetCurrent takes an experiment name and returns the experiment value
|
||||
|
|
|
@ -11941,10 +11941,6 @@ resource "test_resource" "c" {
|
|||
func TestContext2Apply_variableSensitivity(t *testing.T) {
|
||||
m := testModuleInline(t, map[string]string{
|
||||
"main.tf": `
|
||||
terraform {
|
||||
experiments = [sensitive_variables]
|
||||
}
|
||||
|
||||
variable "sensitive_var" {
|
||||
default = "foo"
|
||||
sensitive = true
|
||||
|
@ -12029,10 +12025,6 @@ resource "test_resource" "foo" {
|
|||
func TestContext2Apply_variableSensitivityPropagation(t *testing.T) {
|
||||
m := testModuleInline(t, map[string]string{
|
||||
"main.tf": `
|
||||
terraform {
|
||||
experiments = [sensitive_variables]
|
||||
}
|
||||
|
||||
variable "sensitive_map" {
|
||||
type = map(string)
|
||||
default = {
|
||||
|
@ -12092,10 +12084,6 @@ resource "test_resource" "foo" {
|
|||
func TestContext2Apply_variableSensitivityChange(t *testing.T) {
|
||||
m := testModuleInline(t, map[string]string{
|
||||
"main.tf": `
|
||||
terraform {
|
||||
experiments = [sensitive_variables]
|
||||
}
|
||||
|
||||
variable "sensitive_var" {
|
||||
default = "hello"
|
||||
sensitive = true
|
||||
|
@ -12157,10 +12145,6 @@ resource "test_resource" "foo" {
|
|||
|
||||
m2 := testModuleInline(t, map[string]string{
|
||||
"main.tf": `
|
||||
terraform {
|
||||
experiments = [sensitive_variables]
|
||||
}
|
||||
|
||||
variable "sensitive_var" {
|
||||
default = "hello"
|
||||
sensitive = false
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
terraform {
|
||||
experiments = [sensitive_variables]
|
||||
}
|
||||
|
||||
variable "sensitive_var" {
|
||||
default = "foo"
|
||||
sensitive = true
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
terraform {
|
||||
experiments = [sensitive_variables]
|
||||
}
|
||||
|
||||
variable "sensitive_var" {
|
||||
default = "foo"
|
||||
sensitive = true
|
||||
|
|
Loading…
Reference in New Issue