Merge pull request #28624 from hashicorp/jbardin/schema-value-marks

null check in ValueMarks
This commit is contained in:
James Bardin 2021-05-06 11:28:34 -04:00 committed by GitHub
commit ecd030eb26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,9 @@ func (b *Block) ValueMarks(val cty.Value, path cty.Path) []cty.PathValueMarks {
} }
} }
if val.IsNull() {
return pvm
}
for name, blockS := range b.BlockTypes { for name, blockS := range b.BlockTypes {
// If our block doesn't contain any sensitive attributes, skip inspecting it // If our block doesn't contain any sensitive attributes, skip inspecting it
if !blockS.Block.ContainsSensitive() { if !blockS.Block.ContainsSensitive() {

View File

@ -47,6 +47,10 @@ func TestBlockValueMarks(t *testing.T) {
cty.UnknownVal(schema.ImpliedType()), cty.UnknownVal(schema.ImpliedType()),
cty.UnknownVal(schema.ImpliedType()), cty.UnknownVal(schema.ImpliedType()),
}, },
{
cty.NullVal(schema.ImpliedType()),
cty.NullVal(schema.ImpliedType()),
},
{ {
cty.ObjectVal(map[string]cty.Value{ cty.ObjectVal(map[string]cty.Value{
"sensitive": cty.UnknownVal(cty.String), "sensitive": cty.UnknownVal(cty.String),