Cover NestingMap case
This commit is contained in:
parent
f790332bff
commit
a5c5d2c28c
|
@ -974,15 +974,12 @@ func getValMarks(schema *configschema.Block, val cty.Value, path cty.Path) []cty
|
|||
switch blockS.Nesting {
|
||||
case configschema.NestingSingle, configschema.NestingGroup:
|
||||
pvm = append(pvm, getValMarks(&blockS.Block, blockV, blockPath)...)
|
||||
case configschema.NestingList:
|
||||
case configschema.NestingList, configschema.NestingMap:
|
||||
for it := blockV.ElementIterator(); it.Next(); {
|
||||
idx, blockEV := it.Element()
|
||||
morePaths := getValMarks(&blockS.Block, blockEV, append(blockPath, cty.IndexStep{Key: idx}))
|
||||
pvm = append(pvm, morePaths...)
|
||||
}
|
||||
case configschema.NestingMap:
|
||||
// TODO
|
||||
continue
|
||||
case configschema.NestingSet:
|
||||
// TODO
|
||||
continue
|
||||
|
|
|
@ -135,7 +135,7 @@ func TestEvaluatorGetResource(t *testing.T) {
|
|||
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
|
||||
&states.ResourceInstanceObjectSrc{
|
||||
Status: states.ObjectReady,
|
||||
AttrsJSON: []byte(`{"id":"foo", "value":"hello", "nesting_list": [{"sensitive_value":"abc"}]}`),
|
||||
AttrsJSON: []byte(`{"id":"foo", "nesting_list": [{"sensitive_value":"abc"}], "nesting_map": {"foo":{"foo":"x"}}, "value":"hello"}`),
|
||||
},
|
||||
addrs.AbsProviderConfig{
|
||||
Provider: addrs.NewDefaultProvider("test"),
|
||||
|
@ -198,6 +198,14 @@ func TestEvaluatorGetResource(t *testing.T) {
|
|||
},
|
||||
Nesting: configschema.NestingList,
|
||||
},
|
||||
"nesting_map": {
|
||||
Block: configschema.Block{
|
||||
Attributes: map[string]*configschema.Attribute{
|
||||
"foo": {Type: cty.String, Optional: true, Sensitive: true},
|
||||
},
|
||||
},
|
||||
Nesting: configschema.NestingMap,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -219,6 +227,9 @@ func TestEvaluatorGetResource(t *testing.T) {
|
|||
"value": cty.NullVal(cty.String),
|
||||
}),
|
||||
}),
|
||||
"nesting_map": cty.MapVal(map[string]cty.Value{
|
||||
"foo": cty.ObjectVal(map[string]cty.Value{"foo": cty.StringVal("x").Mark("sensitive")}),
|
||||
}),
|
||||
"value": cty.StringVal("hello").Mark("sensitive"),
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue