From 0df8da59f776b211960d9ce52e57a4fa397fdf0a Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 20 Dec 2017 08:46:45 -0500 Subject: [PATCH] add FIXMEs This new codepath with the getDiff "customzed" return value, along with the associated test need to be removed as soon as we can support unset fields from the config, so we don't continue to carry this broken behavior forward any longer than needed. --- helper/schema/schema.go | 5 +++++ helper/schema/schema_test.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/helper/schema/schema.go b/helper/schema/schema.go index edcf58e8f..d9a7aa1a0 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -337,6 +337,11 @@ func (s *Schema) finalizeDiff(d *terraform.ResourceAttrDiff, customized bool) *t } if s.Computed { + // FIXME: This is where the customized bool from getChange finally + // comes into play. It allows the previously incorrect behavior + // of an empty string being used as "unset" when the value is + // computed. This should be removed once we can properly + // represent an unset/nil value from the configuration. if !customized { if d.Old != "" && d.New == "" { // This is a computed value with an old value set already, diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index 72adca4bb..bda54ccee 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -3113,6 +3113,8 @@ func TestSchemaMap_Diff(t *testing.T) { // A lot of resources currently depended on using the empty string as a // nil/unset value. + // FIXME: We want this to eventually produce a diff, since there + // technically is a new value in the config. { Name: "optional, computed, empty string", Schema: map[string]*Schema{