mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +00:00
send scheduling block with automaticrestart if there is none in cfg (#2638)
This commit is contained in:
parent
f3de995944
commit
caa1bd9664
@ -625,13 +625,23 @@ func expandComputeInstance(project string, zone *compute.Zone, d *schema.Resourc
|
|||||||
disks = append(disks, disk)
|
disks = append(disks, disk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sch := d.Get("scheduling").([]interface{})
|
||||||
|
var scheduling *computeBeta.Scheduling
|
||||||
|
if len(sch) == 0 {
|
||||||
|
// TF doesn't do anything about defaults inside of nested objects, so if
|
||||||
|
// scheduling hasn't been set, then send it with its default values.
|
||||||
|
scheduling = &computeBeta.Scheduling{
|
||||||
|
AutomaticRestart: googleapi.Bool(true),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
prefix := "scheduling.0"
|
prefix := "scheduling.0"
|
||||||
scheduling := &computeBeta.Scheduling{
|
scheduling = &computeBeta.Scheduling{
|
||||||
AutomaticRestart: googleapi.Bool(d.Get(prefix + ".automatic_restart").(bool)),
|
AutomaticRestart: googleapi.Bool(d.Get(prefix + ".automatic_restart").(bool)),
|
||||||
Preemptible: d.Get(prefix + ".preemptible").(bool),
|
Preemptible: d.Get(prefix + ".preemptible").(bool),
|
||||||
OnHostMaintenance: d.Get(prefix + ".on_host_maintenance").(string),
|
OnHostMaintenance: d.Get(prefix + ".on_host_maintenance").(string),
|
||||||
ForceSendFields: []string{"AutomaticRestart", "Preemptible"},
|
ForceSendFields: []string{"AutomaticRestart", "Preemptible"},
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
metadata, err := resourceInstanceMetadata(d)
|
metadata, err := resourceInstanceMetadata(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user