@@ -181,23 +181,20 @@ func resourceStorageTransferJob() *schema.Resource {
181
181
"schedule_start_date" : {
182
182
Type : schema .TypeList ,
183
183
Required : true ,
184
- ForceNew : true ,
185
184
MaxItems : 1 ,
186
185
Elem : dateObjectSchema (),
187
186
Description : `The first day the recurring transfer is scheduled to run. If schedule_start_date is in the past, the transfer will run for the first time on the following day.` ,
188
187
},
189
188
"schedule_end_date" : {
190
189
Type : schema .TypeList ,
191
190
Optional : true ,
192
- ForceNew : true ,
193
191
MaxItems : 1 ,
194
192
Elem : dateObjectSchema (),
195
193
Description : `The last day the recurring transfer will be run. If schedule_end_date is the same as schedule_start_date, the transfer will be executed only once.` ,
196
194
},
197
195
"start_time_of_day" : {
198
196
Type : schema .TypeList ,
199
197
Optional : true ,
200
- ForceNew : true ,
201
198
MaxItems : 1 ,
202
199
Elem : timeObjectSchema (),
203
200
DiffSuppressFunc : diffSuppressEmptyStartTimeOfDay ,
@@ -334,28 +331,24 @@ func timeObjectSchema() *schema.Resource {
334
331
"hours" : {
335
332
Type : schema .TypeInt ,
336
333
Required : true ,
337
- ForceNew : true ,
338
334
ValidateFunc : validation .IntBetween (0 , 24 ),
339
335
Description : `Hours of day in 24 hour format. Should be from 0 to 23.` ,
340
336
},
341
337
"minutes" : {
342
338
Type : schema .TypeInt ,
343
339
Required : true ,
344
- ForceNew : true ,
345
340
ValidateFunc : validation .IntBetween (0 , 59 ),
346
341
Description : `Minutes of hour of day. Must be from 0 to 59.` ,
347
342
},
348
343
"seconds" : {
349
344
Type : schema .TypeInt ,
350
345
Required : true ,
351
- ForceNew : true ,
352
346
ValidateFunc : validation .IntBetween (0 , 60 ),
353
347
Description : `Seconds of minutes of the time. Must normally be from 0 to 59.` ,
354
348
},
355
349
"nanos" : {
356
350
Type : schema .TypeInt ,
357
351
Required : true ,
358
- ForceNew : true ,
359
352
ValidateFunc : validation .IntBetween (0 , 999999999 ),
360
353
Description : `Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.` ,
361
354
},
@@ -369,23 +362,20 @@ func dateObjectSchema() *schema.Resource {
369
362
"year" : {
370
363
Type : schema .TypeInt ,
371
364
Required : true ,
372
- ForceNew : true ,
373
365
ValidateFunc : validation .IntBetween (0 , 9999 ),
374
366
Description : `Year of date. Must be from 1 to 9999.` ,
375
367
},
376
368
377
369
"month" : {
378
370
Type : schema .TypeInt ,
379
371
Required : true ,
380
- ForceNew : true ,
381
372
ValidateFunc : validation .IntBetween (1 , 12 ),
382
373
Description : `Month of year. Must be from 1 to 12.` ,
383
374
},
384
375
385
376
"day" : {
386
377
Type : schema .TypeInt ,
387
378
Required : true ,
388
- ForceNew : true ,
389
379
ValidateFunc : validation .IntBetween (0 , 31 ),
390
380
Description : `Day of month. Must be from 1 to 31 and valid for the year and month.` ,
391
381
},
@@ -638,29 +628,29 @@ func resourceStorageTransferJobUpdate(d *schema.ResourceData, meta interface{})
638
628
fieldMask := []string {}
639
629
640
630
if d .HasChange ("description" ) {
631
+ fieldMask = append (fieldMask , "description" )
641
632
if v , ok := d .GetOk ("description" ); ok {
642
- fieldMask = append (fieldMask , "description" )
643
633
transferJob .Description = v .(string )
644
634
}
645
635
}
646
636
647
637
if d .HasChange ("status" ) {
638
+ fieldMask = append (fieldMask , "status" )
648
639
if v , ok := d .GetOk ("status" ); ok {
649
- fieldMask = append (fieldMask , "status" )
650
640
transferJob .Status = v .(string )
651
641
}
652
642
}
653
643
654
644
if d .HasChange ("schedule" ) {
645
+ fieldMask = append (fieldMask , "schedule" )
655
646
if v , ok := d .GetOk ("schedule" ); ok {
656
- fieldMask = append (fieldMask , "schedule" )
657
647
transferJob .Schedule = expandTransferSchedules (v .([]interface {}))
658
648
}
659
649
}
660
650
661
651
if d .HasChange ("transfer_spec" ) {
652
+ fieldMask = append (fieldMask , "transfer_spec" )
662
653
if v , ok := d .GetOk ("transfer_spec" ); ok {
663
- fieldMask = append (fieldMask , "transfer_spec" )
664
654
transferJob .TransferSpec = expandTransferSpecs (v .([]interface {}))
665
655
}
666
656
}
@@ -674,6 +664,10 @@ func resourceStorageTransferJobUpdate(d *schema.ResourceData, meta interface{})
674
664
}
675
665
}
676
666
667
+ if len (fieldMask ) == 0 {
668
+ return nil
669
+ }
670
+
677
671
updateRequest := & storagetransfer.UpdateTransferJobRequest {
678
672
ProjectId : project ,
679
673
TransferJob : transferJob ,
0 commit comments