Skip to content

Commit 9b01220

Browse files
committed
fix
1 parent 3db2d11 commit 9b01220

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,11 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
22612261
{{ if ne $.TargetVersionName `ga` -}}
22622262
// Workaround: restore nanos from state since the API doesn't persist it (see comment above).
22632263
if hadNanos {
2264-
scheduling := flattenScheduling(instance.Scheduling)
2264+
schedulingMap, err := tpgresource.ConvertToMap(instance.Scheduling)
2265+
if err != nil {
2266+
return fmt.Errorf("Error converting scheduling for nanos workaround: %s", err)
2267+
}
2268+
scheduling := flattenScheduling(schedulingMap)
22652269
graceful_shutdown := scheduling[0]["graceful_shutdown"].([]interface{})[0].(map[string]interface{})
22662270
max_duration := graceful_shutdown["max_duration"].([]interface{})[0].(map[string]interface{})
22672271
max_duration["nanos"] = int64(savedNanos.(int))

0 commit comments

Comments
 (0)