diff --git a/grafana/resource_dashboard.go b/grafana/resource_dashboard.go index aa31bafec..f9a6887ca 100644 --- a/grafana/resource_dashboard.go +++ b/grafana/resource_dashboard.go @@ -2,7 +2,6 @@ package grafana import ( "encoding/json" - "errors" "fmt" "log" @@ -18,7 +17,7 @@ func ResourceDashboard() *schema.Resource { Update: UpdateDashboard, Delete: DeleteDashboard, Importer: &schema.ResourceImporter{ - State: ImportDashboard, + State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ @@ -120,15 +119,6 @@ func DeleteDashboard(d *schema.ResourceData, meta interface{}) error { return client.DeleteDashboard(slug) } -func ImportDashboard(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - err := ReadDashboard(d, meta) - - if err != nil || d.Id() == "" { - return nil, errors.New(fmt.Sprintf("Error: Unable to import Grafana Dashboard: %s.", err)) - } - return []*schema.ResourceData{d}, nil -} - func prepareDashboardModel(configJSON string) map[string]interface{} { configMap := map[string]interface{}{} err := json.Unmarshal([]byte(configJSON), &configMap) diff --git a/grafana/resource_dashboard_test.go b/grafana/resource_dashboard_test.go index 657bd9c6f..c7312fbed 100644 --- a/grafana/resource_dashboard_test.go +++ b/grafana/resource_dashboard_test.go @@ -87,7 +87,7 @@ func TestAccDashboard_disappear(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccDashboardCheckDestroy(&dashboard), Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccDashboardConfig_disappear, Check: resource.ComposeTestCheckFunc( testAccDashboardCheckExists("grafana_dashboard.test", &dashboard),