From 92a3270dca92b7f8c0c0eaed8a9d3d16439ea0a9 Mon Sep 17 00:00:00 2001 From: Artem Iarmoliuk Date: Fri, 22 Dec 2017 15:59:54 +0200 Subject: [PATCH] Fix refresh 404 error for kibana object --- resource_elasticsearch_kibana_object.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resource_elasticsearch_kibana_object.go b/resource_elasticsearch_kibana_object.go index ae661eb6..17beb3b3 100644 --- a/resource_elasticsearch_kibana_object.go +++ b/resource_elasticsearch_kibana_object.go @@ -91,7 +91,12 @@ func resourceElasticsearchKibanaObjectRead(d *schema.ResourceData, meta interfac // termQuery := elastic.Query(elastic.NewTermQuery("title", id)) result, err := client.Get().Index(d.Get("index").(string)).Type(objectType).Id(id).Do(context.TODO()) if err != nil { - log.Printf("[INFO] Not found: %s %s %s", id, objectType, d.Get("index").(string)) + if elastic.IsNotFound(err) { + log.Printf("[WARN] Kibana Object (%s) not found, removing from state", id) + d.SetId("") + return nil + } + return err } if result.Found {