From 2448d1d38b2e3c2fe5bb3fc5656038e0cfe50157 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 19 Jun 2019 22:41:23 -0400 Subject: [PATCH] move timeout handling to grpc_provider simpleDiff is only called from the grpc_provider, and we always need to make sure the timeouts are encoded in the private data. --- helper/schema/resource.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/helper/schema/resource.go b/helper/schema/resource.go index b5e306574..bcfe5666f 100644 --- a/helper/schema/resource.go +++ b/helper/schema/resource.go @@ -329,21 +329,13 @@ func (r *Resource) simpleDiff( c *terraform.ResourceConfig, meta interface{}) (*terraform.InstanceDiff, error) { - t := &ResourceTimeout{} - err := t.ConfigDecode(r, c) - - if err != nil { - return nil, fmt.Errorf("[ERR] Error decoding timeout: %s", err) - } - instanceDiff, err := schemaMap(r.Schema).Diff(s, c, r.CustomizeDiff, meta, false) if err != nil { return instanceDiff, err } if instanceDiff == nil { - log.Printf("[DEBUG] Instance Diff is nil in SimpleDiff()") - return nil, err + instanceDiff = terraform.NewInstanceDiff() } // Make sure the old value is set in each of the instance diffs. @@ -357,10 +349,7 @@ func (r *Resource) simpleDiff( } } - if err := t.DiffEncode(instanceDiff); err != nil { - log.Printf("[ERR] Error encoding timeout to instance diff: %s", err) - } - return instanceDiff, err + return instanceDiff, nil } // Validate validates the resource configuration against the schema.