Skip to content

Commit

Permalink
Catch 404s when deleting default networks. (#4137)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and paddycarver committed Aug 12, 2019
1 parent 92e352d commit bcf010a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion google/resource_google_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ func resourceGoogleProjectCreate(d *schema.ResourceData, meta interface{}) error
}

if err = forceDeleteComputeNetwork(project.ProjectId, "default", config); err != nil {
return fmt.Errorf("Error deleting default network in project %s: %s", project.ProjectId, err)
if isGoogleApiErrorWithCode(err, 404) {
log.Printf("[DEBUG] Default network not found for project %q, no need to delete it", project.ProjectId)
} else {
return fmt.Errorf("Error deleting default network in project %s: %s", project.ProjectId, err)
}
}
}
return nil
Expand Down

0 comments on commit bcf010a

Please sign in to comment.