diff --git a/cloudflare/resource_cloudflare_logpush_job.go b/cloudflare/resource_cloudflare_logpush_job.go index 2ff8921cd8..c9c065d654 100644 --- a/cloudflare/resource_cloudflare_logpush_job.go +++ b/cloudflare/resource_cloudflare_logpush_job.go @@ -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) @@ -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) {