From 9052914cf16ea7f4812cfc9cb40132a626f22a3f Mon Sep 17 00:00:00 2001 From: Emily Ye Date: Fri, 17 May 2019 13:50:15 -0700 Subject: [PATCH] diff suppress empty value for start time of day --- .../resources/resource_storage_transfer_job.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/third_party/terraform/resources/resource_storage_transfer_job.go b/third_party/terraform/resources/resource_storage_transfer_job.go index 6526c58a82ee..e9a5b15372b5 100644 --- a/third_party/terraform/resources/resource_storage_transfer_job.go +++ b/third_party/terraform/resources/resource_storage_transfer_job.go @@ -96,11 +96,12 @@ func resourceStorageTransferJob() *schema.Resource { Elem: dateObjectSchema(), }, "start_time_of_day": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - MaxItems: 1, - Elem: timeObjectSchema(), + Type: schema.TypeList, + Optional: true, + ForceNew: true, + MaxItems: 1, + Elem: timeObjectSchema(), + DiffSuppressFunc: diffSuppressEmptyStartTimeOfDay, }, }, }, @@ -301,6 +302,10 @@ func httpDataSchema() *schema.Resource { } } +func diffSuppressEmptyStartTimeOfDay(k, old, new string, d *schema.ResourceData) bool { + return k == "schedule.0.start_time_of_day.#" && old == "1" && new == "0" +} + func resourceStorageTransferJobCreate(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config)