Skip to content

Commit

Permalink
Merge pull request #28036 from hashicorp/pselle/provider_sensitivity_…
Browse files Browse the repository at this point in the history
…non-experiment

Make provider sensitivity default behavior
  • Loading branch information
Pam Selle authored Mar 15, 2021
2 parents fac60ab + 6ff1d29 commit 34536da
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 25 deletions.
2 changes: 1 addition & 1 deletion experiments/experiment.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ 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.")
registerConcludedExperiment(SuppressProviderSensitiveAttrs, "Provider-defined sensitive attributes are now redacted by default, without enabling an experiment.")
registerCurrentExperiment(ModuleVariableOptionalAttrs)
registerCurrentExperiment(SuppressProviderSensitiveAttrs)
}

// GetCurrent takes an experiment name and returns the experiment value
Expand Down
4 changes: 0 additions & 4 deletions terraform/context_apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11938,10 +11938,6 @@ resource "test_resource" "foo" {
func TestContext2Apply_variableSensitivityProviders(t *testing.T) {
m := testModuleInline(t, map[string]string{
"main.tf": `
terraform {
experiments = [provider_sensitive_attrs]
}
resource "test_resource" "foo" {
sensitive_value = "should get marked"
}
Expand Down
21 changes: 6 additions & 15 deletions terraform/evaluate.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/experiments"
"github.com/hashicorp/terraform/instances"
"github.com/hashicorp/terraform/lang"
"github.com/hashicorp/terraform/plans"
Expand Down Expand Up @@ -758,15 +757,11 @@ func (d *evaluationStateData) GetResource(addr addrs.Resource, rng tfdiags.Sourc
continue
}

// EXPERIMENTAL: Suppressing provider-defined sensitive attrs
// from Terraform output.

// If our schema contains sensitive values, mark those as sensitive
if moduleConfig.Module.ActiveExperiments.Has(experiments.SuppressProviderSensitiveAttrs) {
if schema.ContainsSensitive() {
val = markProviderSensitiveAttributes(schema, val)
}
// If our provider schema contains sensitive values, mark those as sensitive
if schema.ContainsSensitive() {
val = markProviderSensitiveAttributes(schema, val)
}

instances[key] = val.MarkWithPaths(change.AfterValMarks)
continue
}
Expand All @@ -785,14 +780,10 @@ func (d *evaluationStateData) GetResource(addr addrs.Resource, rng tfdiags.Sourc
}

val := ios.Value
// EXPERIMENTAL: Suppressing provider-defined sensitive attrs
// from Terraform output.

// If our schema contains sensitive values, mark those as sensitive
if moduleConfig.Module.ActiveExperiments.Has(experiments.SuppressProviderSensitiveAttrs) {
if schema.ContainsSensitive() {
val = markProviderSensitiveAttributes(schema, val)
}
if schema.ContainsSensitive() {
val = markProviderSensitiveAttributes(schema, val)
}
instances[key] = val
}
Expand Down
5 changes: 0 additions & 5 deletions terraform/evaluate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/experiments"
"github.com/hashicorp/terraform/plans"
"github.com/hashicorp/terraform/states"
"github.com/hashicorp/terraform/tfdiags"
Expand Down Expand Up @@ -190,8 +189,6 @@ func TestEvaluatorGetResource(t *testing.T) {
ManagedResources: map[string]*configs.Resource{
"test_resource.foo": rc,
},
// Necessary while provider sensitive attrs are experimental
ActiveExperiments: experiments.NewSet(experiments.SuppressProviderSensitiveAttrs),
},
},
State: stateSync,
Expand Down Expand Up @@ -421,8 +418,6 @@ func TestEvaluatorGetResource_changes(t *testing.T) {
},
},
},
// Necessary while provider sensitive attrs are experimental
ActiveExperiments: experiments.NewSet(experiments.SuppressProviderSensitiveAttrs),
},
},
State: stateSync,
Expand Down

0 comments on commit 34536da

Please sign in to comment.