Skip to content

Commit 739f9cf

Browse files
committed
fix
1 parent 4b3538c commit 739f9cf

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
@@ -2260,7 +2260,11 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
22602260
{{ if ne $.TargetVersionName `ga` -}}
22612261
// Workaround: restore nanos from state since the API doesn't persist it (see comment above).
22622262
if hadNanos {
2263-
scheduling := flattenScheduling(instance.Scheduling)
2263+
schedulingMap, err := tpgresource.ConvertToMap(instance.Scheduling)
2264+
if err != nil {
2265+
return fmt.Errorf("Error converting scheduling for nanos workaround: %s", err)
2266+
}
2267+
scheduling := flattenScheduling(schedulingMap)
22642268
graceful_shutdown := scheduling[0]["graceful_shutdown"].([]interface{})[0].(map[string]interface{})
22652269
max_duration := graceful_shutdown["max_duration"].([]interface{})[0].(map[string]interface{})
22662270
max_duration["nanos"] = int64(savedNanos.(int))

0 commit comments

Comments
 (0)