From 133d3d79714077d8009e35759ac7dad18522e6b6 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 2 May 2019 16:20:59 -0400 Subject: [PATCH] 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. --- helper/schema/field_reader_config.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/helper/schema/field_reader_config.go b/helper/schema/field_reader_config.go index 55a301d81..cf50e23c0 100644 --- a/helper/schema/field_reader_config.go +++ b/helper/schema/field_reader_config.go @@ -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)