Skip to content

Commit

Permalink
Merge pull request #798 from trjstewart/fix_logpush_job_read
Browse files Browse the repository at this point in the history
set logpush job id to "" when not found
  • Loading branch information
jacobbednarz authored Sep 22, 2020
2 parents 3933b04 + 19f0c59 commit a915424
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cloudflare/resource_cloudflare_logpush_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func resourceCloudflareLogpushJobRead(d *schema.ResourceData, meta interface{})
if err != nil {
if strings.Contains(err.Error(), "404") {
log.Printf("[INFO] Could not find LogpushJob with id: %q", jobID)
d.SetId("")
return nil
}
return fmt.Errorf("error finding logpush job %q: %s", jobID, err)
Expand Down Expand Up @@ -163,10 +164,17 @@ func resourceCloudflareLogpushJobDelete(d *schema.ResourceData, meta interface{}

deleteErr := client.DeleteLogpushJob(d.Get("zone_id").(string), job.ID)
if deleteErr != nil {
if strings.Contains(err.Error(), "job not found") {
log.Printf("[INFO] Could not find logpush job with id: %q", job.ID)
d.SetId("")
return nil
}
return fmt.Errorf("error deleting logpush job: %+v", job.ID)
}

return resourceCloudflareLogpushJobRead(d, meta)
d.SetId("")

return nil
}

func resourceCloudflareLogpushJobImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
Expand Down

0 comments on commit a915424

Please sign in to comment.