Skip to content

Commit

Permalink
change error wrap formatting (GoogleCloudPlatform#3089)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisst authored and Nathan Klish committed May 18, 2020
1 parent da5762c commit f99f9bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions third_party/terraform/resources/resource_google_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ func resourceGoogleProjectCreate(d *schema.ResourceData, meta interface{}) error
if !d.Get("auto_create_network").(bool) {
// The compute API has to be enabled before we can delete a network.
if err = enableServiceUsageProjectServices([]string{"compute.googleapis.com"}, project.ProjectId, config, d.Timeout(schema.TimeoutCreate)); err != nil {
return errwrap.Wrapf("Error enabling the Compute Engine API required to delete the default network: ", err)
return errwrap.Wrapf("Error enabling the Compute Engine API required to delete the default network: {{err}} ", err)
}

if err = forceDeleteComputeNetwork(d, config, project.ProjectId, "default"); err != nil {
if isGoogleApiErrorWithCode(err, 404) {
log.Printf("[DEBUG] Default network not found for project %q, no need to delete it", project.ProjectId)
} else {
return errwrap.Wrapf(fmt.Sprintf("Error deleting default network in project %s: ", project.ProjectId), err)
return errwrap.Wrapf(fmt.Sprintf("Error deleting default network in project %s: {{err}}", project.ProjectId), err)
}
}
}
Expand Down Expand Up @@ -397,15 +397,15 @@ func forceDeleteComputeNetwork(d *schema.ResourceData, config *Config, projectId
filter := fmt.Sprintf("network eq %s", networkLink)
resp, err := config.clientCompute.Firewalls.List(projectId).Filter(filter).Do()
if err != nil {
return errwrap.Wrapf("Error listing firewall rules in proj:", err)
return errwrap.Wrapf("Error listing firewall rules in proj: {{err}}", err)
}

log.Printf("[DEBUG] Found %d firewall rules in %q network", len(resp.Items), networkName)

for _, firewall := range resp.Items {
op, err := config.clientCompute.Firewalls.Delete(projectId, firewall.Name).Do()
if err != nil {
return errwrap.Wrapf("Error deleting firewall: ", err)
return errwrap.Wrapf("Error deleting firewall: {{err}}", err)
}
err = computeOperationWait(config, op, projectId, "Deleting Firewall")
if err != nil {
Expand Down Expand Up @@ -456,7 +456,7 @@ func deleteComputeNetwork(project, network string, config *Config) error {
op, err := config.clientCompute.Networks.Delete(
project, network).Do()
if err != nil {
return errwrap.Wrapf("Error deleting network: ", err)
return errwrap.Wrapf("Error deleting network: {{err}}", err)
}

err = computeOperationWaitTime(config, op, project, "Deleting Network", 10)
Expand Down

0 comments on commit f99f9bf

Please sign in to comment.