helper/schema: Move computed key reader logic to childAddrOf

This will make this check safer and will remove the risk of it passing
on keys with a similar prefix.
This commit is contained in:
Chris Marchesi 2017-05-31 09:51:00 -07:00 committed by Martin Atkins
parent 36aa63b338
commit 3444549d60

View File

@ -78,7 +78,7 @@ func (r *newValueReader) ReadField(address []string) (FieldReadResult, error) {
return FieldReadResult{}, err
}
for computedKey := range r.computedKeys {
if strings.HasPrefix(addrKey, computedKey) {
if childAddrOf(addrKey, computedKey) {
if strings.HasSuffix(addrKey, ".#") {
// This is a count value for a list or set that has been marked as
// computed, or a sub-list/sub-set of a complex resource that has