Reordering so attributes are first (understandability)

This commit is contained in:
Pam Selle 2020-10-14 17:45:57 -04:00
parent e44e03b283
commit ee9ec8a193
1 changed files with 10 additions and 10 deletions

View File

@ -954,6 +954,16 @@ func markProviderSensitiveAttributes(schema *configschema.Block, val cty.Value)
func getValMarks(schema *configschema.Block, val cty.Value, path cty.Path) []cty.PathValueMarks {
var pvm []cty.PathValueMarks
for name, attrS := range schema.Attributes {
if attrS.Sensitive {
attrPath := append(path, cty.GetAttrStep{Name: name})
pvm = append(pvm, cty.PathValueMarks{
Path: attrPath,
Marks: cty.NewValueMarks("sensitive"),
})
}
}
for name, blockS := range schema.BlockTypes {
// If our block doesn't contain any sensitive attributes, skip inspecting it
if !blockS.Block.ContainsSensitive() {
@ -980,15 +990,5 @@ func getValMarks(schema *configschema.Block, val cty.Value, path cty.Path) []cty
panic(fmt.Sprintf("unsupported nesting mode %s", blockS.Nesting))
}
}
for name, attrS := range schema.Attributes {
if attrS.Sensitive {
attrPath := append(path, cty.GetAttrStep{Name: name})
pvm = append(pvm, cty.PathValueMarks{
Path: attrPath,
Marks: cty.NewValueMarks("sensitive"),
})
}
}
return pvm
}