check for computed values in the config

First check the ComputedValues field in the config when reading config
field, so that we can detect if there is an unknown value in a
container. Since maps, lists and sets are verified to exist by looking
for a "length" first, an unknown config value in the config is ignored.
This commit is contained in:
James Bardin 2019-05-02 16:20:59 -04:00 committed by Martin Atkins
parent 43f0468829
commit 133d3d7971
1 changed files with 12 additions and 0 deletions

View File

@ -93,6 +93,18 @@ func (r *ConfigFieldReader) readField(
}
}
if protoVersion5 {
// Check if the value itself is unknown.
// The new protocol shims will add unknown values to this list of
// ComputedKeys. THis is the only way we have to indicate that a
// collection is unknown in the config
for _, unknown := range r.Config.ComputedKeys {
if k == unknown {
return FieldReadResult{Computed: true, Exists: true}, nil
}
}
}
switch schema.Type {
case TypeBool, TypeFloat, TypeInt, TypeString:
return r.readPrimitive(k, schema)