@@ -667,20 +667,12 @@ func expandComputeInstance(project string, zone *compute.Zone, d *schema.Resourc
667
667
}
668
668
669
669
prefix := "scheduling.0"
670
- scheduling := & computeBeta.Scheduling {}
671
-
672
- if val , ok := d .GetOk (prefix + ".automatic_restart" ); ok {
673
- scheduling .AutomaticRestart = googleapi .Bool (val .(bool ))
674
- }
675
-
676
- if val , ok := d .GetOk (prefix + ".preemptible" ); ok {
677
- scheduling .Preemptible = val .(bool )
678
- }
679
-
680
- if val , ok := d .GetOk (prefix + ".on_host_maintenance" ); ok {
681
- scheduling .OnHostMaintenance = val .(string )
670
+ scheduling := & computeBeta.Scheduling {
671
+ AutomaticRestart : googleapi .Bool (d .Get (prefix + ".automatic_restart" ).(bool )),
672
+ Preemptible : d .Get (prefix + ".preemptible" ).(bool ),
673
+ OnHostMaintenance : d .Get (prefix + ".on_host_maintenance" ).(string ),
674
+ ForceSendFields : []string {"AutomaticRestart" , "Preemptible" },
682
675
}
683
- scheduling .ForceSendFields = []string {"AutomaticRestart" , "Preemptible" }
684
676
685
677
metadata , err := resourceInstanceMetadata (d )
686
678
if err != nil {
@@ -1069,18 +1061,12 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err
1069
1061
1070
1062
if d .HasChange ("scheduling" ) {
1071
1063
prefix := "scheduling.0"
1072
- scheduling := & compute.Scheduling {}
1073
-
1074
- if val , ok := d .GetOk (prefix + ".automatic_restart" ); ok {
1075
- scheduling .AutomaticRestart = googleapi .Bool (val .(bool ))
1076
- }
1077
- if val , ok := d .GetOk (prefix + ".preemptible" ); ok {
1078
- scheduling .Preemptible = val .(bool )
1079
- }
1080
- if val , ok := d .GetOk (prefix + ".on_host_maintenance" ); ok {
1081
- scheduling .OnHostMaintenance = val .(string )
1064
+ scheduling := & compute.Scheduling {
1065
+ AutomaticRestart : googleapi .Bool (d .Get (prefix + ".automatic_restart" ).(bool )),
1066
+ Preemptible : d .Get (prefix + ".preemptible" ).(bool ),
1067
+ OnHostMaintenance : d .Get (prefix + ".on_host_maintenance" ).(string ),
1068
+ ForceSendFields : []string {"AutomaticRestart" , "Preemptible" },
1082
1069
}
1083
- scheduling .ForceSendFields = []string {"AutomaticRestart" , "Preemptible" }
1084
1070
1085
1071
op , err := config .clientCompute .Instances .SetScheduling (project ,
1086
1072
zone , d .Id (), scheduling ).Do ()
0 commit comments