Skip to content

Commit 2c064e9

Browse files
committed
fix
1 parent 2c222b9 commit 2c064e9

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
@@ -2237,7 +2237,11 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
22372237
{{ if ne $.TargetVersionName `ga` -}}
22382238
// Workaround: restore nanos from state since the API doesn't persist it (see comment above).
22392239
if hadNanos {
2240-
scheduling := flattenScheduling(instance.Scheduling)
2240+
schedulingMap, err := tpgresource.ConvertToMap(instance.Scheduling)
2241+
if err != nil {
2242+
return fmt.Errorf("Error converting scheduling for nanos workaround: %s", err)
2243+
}
2244+
scheduling := flattenScheduling(schedulingMap)
22412245
graceful_shutdown := scheduling[0]["graceful_shutdown"].([]interface{})[0].(map[string]interface{})
22422246
max_duration := graceful_shutdown["max_duration"].([]interface{})[0].(map[string]interface{})
22432247
max_duration["nanos"] = int64(savedNanos.(int))

0 commit comments

Comments
 (0)