mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
fix config generation with optional empty sensitive string (#1986)
Signed-off-by: ollevche <ollevche@gmail.com>
This commit is contained in:
committed by
GitHub
parent
aa657ef0fb
commit
d896e939f0
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/opentofu/opentofu/internal/addrs"
|
||||
"github.com/opentofu/opentofu/internal/configs/configschema"
|
||||
"github.com/opentofu/opentofu/internal/lang/marks"
|
||||
)
|
||||
|
||||
func TestConfigGeneration(t *testing.T) {
|
||||
@@ -490,6 +491,38 @@ resource "tfcoremock_simple_resource" "example" {
|
||||
juststr = "{a=b}"
|
||||
secrets = null # sensitive
|
||||
sensitivejsonobj = null # sensitive
|
||||
}`,
|
||||
},
|
||||
"optional_empty_sensitive_string": {
|
||||
schema: &configschema.Block{
|
||||
Attributes: map[string]*configschema.Attribute{
|
||||
"str": {
|
||||
Type: cty.String,
|
||||
Optional: true,
|
||||
Sensitive: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
addr: addrs.AbsResourceInstance{
|
||||
Module: nil,
|
||||
Resource: addrs.ResourceInstance{
|
||||
Resource: addrs.Resource{
|
||||
Mode: addrs.ManagedResourceMode,
|
||||
Type: "tfcoremock_simple_resource",
|
||||
Name: "example",
|
||||
},
|
||||
Key: nil,
|
||||
},
|
||||
},
|
||||
provider: addrs.LocalProviderConfig{
|
||||
LocalName: "tfcoremock",
|
||||
},
|
||||
value: cty.ObjectVal(map[string]cty.Value{
|
||||
"str": cty.StringVal("").Mark(marks.Sensitive),
|
||||
}),
|
||||
expected: `
|
||||
resource "tfcoremock_simple_resource" "example" {
|
||||
str = null # sensitive
|
||||
}`,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user