Skip to content

Commit

Permalink
Handle compute instance not found crash (#5955) (#11602)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Apr 27, 2022
1 parent 5c0142b commit 36b6b5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/5955.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
compute: fixed a crash when `compute.instance` is not found
```
2 changes: 1 addition & 1 deletion google/resource_compute_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 36b6b5c

Please sign in to comment.