Merge pull request #26518 from hashicorp/pselle/sensitive-experiment

Remove sensitive_variables experiment
This commit is contained in:
Pam Selle 2020-10-08 16:14:37 -04:00 committed by GitHub
commit eb2a027684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 18 additions and 62 deletions

View File

@ -1,7 +1,3 @@
terraform {
experiments = [sensitive_variables]
}
variable "foo" { variable "foo" {
default = "bar" default = "bar"
} }

View File

@ -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 return diags
} }

View File

@ -260,12 +260,9 @@ func TestModuleOverrideSensitiveVariable(t *testing.T) {
}, },
} }
// TODO: When variable sensitivity is no longer experimental, mod, diags := testModuleFromDir("testdata/valid-modules/override-variable-sensitive")
// move this test folder to "valid-modules" (it currently has a warning)
// and activate the diags assertion
mod, _ := testModuleFromDir("testdata/warning-modules/override-variable")
// assertNoDiagnostics(t, diags) assertNoDiagnostics(t, diags)
if mod == nil { if mod == nil {
t.Fatalf("module is nil") t.Fatalf("module is nil")

View File

@ -1,7 +1,3 @@
terraform {
experiments = [sensitive_variables]
}
variable "sensitive-value" { variable "sensitive-value" {
sensitive = "123" # must be boolean sensitive = "123" # must be boolean
} }

View File

@ -22,3 +22,11 @@ variable "cheeze_pizza" {
variable "π" { variable "π" {
default = 3.14159265359 default = 3.14159265359
} }
variable "sensitive_value" {
default = {
"a" = 1,
"b" = 2
}
sensitive = true
}

View File

@ -16,6 +16,13 @@
}, },
"π": { "π": {
"default": 3.14159265359 "default": 3.14159265359
},
"sensitive_value": {
"default": {
"a": 1,
"b": 2
},
"sensitive": true
} }
} }
} }

View File

@ -1,7 +1,3 @@
terraform {
experiments = [sensitive_variables]
}
variable "false_true" { variable "false_true" {
sensitive = false sensitive = false
} }

View File

@ -1,7 +0,0 @@
terraform {
experiments = [sensitive_variables] # WARNING: Experimental feature "sensitive_variables" is active
}
variable "sensitive-value" {
sensitive = true
}

View File

@ -14,14 +14,12 @@ type Experiment string
// identifier so that it can be specified in configuration. // identifier so that it can be specified in configuration.
const ( const (
VariableValidation = Experiment("variable_validation") VariableValidation = Experiment("variable_validation")
SensitiveVariables = Experiment("sensitive_variables")
) )
func init() { func init() {
// Each experiment constant defined above must be registered here as either // Each experiment constant defined above must be registered here as either
// a current or a concluded experiment. // a current or a concluded experiment.
registerConcludedExperiment(VariableValidation, "Custom variable validation can now be used by default, without enabling an 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 // GetCurrent takes an experiment name and returns the experiment value

View File

@ -11762,10 +11762,6 @@ resource "test_resource" "c" {
func TestContext2Apply_variableSensitivity(t *testing.T) { func TestContext2Apply_variableSensitivity(t *testing.T) {
m := testModuleInline(t, map[string]string{ m := testModuleInline(t, map[string]string{
"main.tf": ` "main.tf": `
terraform {
experiments = [sensitive_variables]
}
variable "sensitive_var" { variable "sensitive_var" {
default = "foo" default = "foo"
sensitive = true sensitive = true
@ -11850,10 +11846,6 @@ resource "test_resource" "foo" {
func TestContext2Apply_variableSensitivityPropagation(t *testing.T) { func TestContext2Apply_variableSensitivityPropagation(t *testing.T) {
m := testModuleInline(t, map[string]string{ m := testModuleInline(t, map[string]string{
"main.tf": ` "main.tf": `
terraform {
experiments = [sensitive_variables]
}
variable "sensitive_map" { variable "sensitive_map" {
type = map(string) type = map(string)
default = { default = {
@ -11913,10 +11905,6 @@ resource "test_resource" "foo" {
func TestContext2Apply_variableSensitivityChange(t *testing.T) { func TestContext2Apply_variableSensitivityChange(t *testing.T) {
m := testModuleInline(t, map[string]string{ m := testModuleInline(t, map[string]string{
"main.tf": ` "main.tf": `
terraform {
experiments = [sensitive_variables]
}
variable "sensitive_var" { variable "sensitive_var" {
default = "hello" default = "hello"
sensitive = true sensitive = true
@ -11978,10 +11966,6 @@ resource "test_resource" "foo" {
m2 := testModuleInline(t, map[string]string{ m2 := testModuleInline(t, map[string]string{
"main.tf": ` "main.tf": `
terraform {
experiments = [sensitive_variables]
}
variable "sensitive_var" { variable "sensitive_var" {
default = "hello" default = "hello"
sensitive = false sensitive = false

View File

@ -1,7 +1,3 @@
terraform {
experiments = [sensitive_variables]
}
variable "sensitive_var" { variable "sensitive_var" {
default = "foo" default = "foo"
sensitive = true sensitive = true

View File

@ -1,7 +1,3 @@
terraform {
experiments = [sensitive_variables]
}
variable "sensitive_var" { variable "sensitive_var" {
default = "foo" default = "foo"
sensitive = true sensitive = true