diff --git a/.changelog/5955.txt b/.changelog/5955.txt new file mode 100644 index 00000000000..95adc47e7f6 --- /dev/null +++ b/.changelog/5955.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: fixed a crash when `compute.instance` is not found +``` diff --git a/google/resource_compute_instance.go b/google/resource_compute_instance.go index d2d5a15041d..0c849f887f4 100644 --- a/google/resource_compute_instance.go +++ b/google/resource_compute_instance.go @@ -1393,7 +1393,7 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err // Change back to getInstance(config, d) once updating alias ips is GA. instance, err := config.NewComputeClient(userAgent).Instances.Get(project, zone, d.Get("name").(string)).Do() if err != nil { - return handleNotFoundError(err, d, fmt.Sprintf("Instance %s", instance.Name)) + return handleNotFoundError(err, d, fmt.Sprintf("Instance %s", d.Get("name").(string))) } // Enable partial mode for the resource since it is possible