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.
This commit is contained in:
James Bardin 2019-06-19 22:41:23 -04:00
parent 1bba574fe9
commit 2448d1d38b
1 changed files with 2 additions and 13 deletions

View File

@ -329,21 +329,13 @@ func (r *Resource) simpleDiff(
c *terraform.ResourceConfig, c *terraform.ResourceConfig,
meta interface{}) (*terraform.InstanceDiff, error) { 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) instanceDiff, err := schemaMap(r.Schema).Diff(s, c, r.CustomizeDiff, meta, false)
if err != nil { if err != nil {
return instanceDiff, err return instanceDiff, err
} }
if instanceDiff == nil { if instanceDiff == nil {
log.Printf("[DEBUG] Instance Diff is nil in SimpleDiff()") instanceDiff = terraform.NewInstanceDiff()
return nil, err
} }
// Make sure the old value is set in each of the instance diffs. // 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 { return instanceDiff, nil
log.Printf("[ERR] Error encoding timeout to instance diff: %s", err)
}
return instanceDiff, err
} }
// Validate validates the resource configuration against the schema. // Validate validates the resource configuration against the schema.