Skip to content

Commit

Permalink
remove resource from state if not found
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchy committed Oct 30, 2024
1 parent 129edb4 commit 7e28bac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/providers/pluginfw/resources/sharing/data_share.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sharing
import (
"context"

"github.com/databricks/databricks-sdk-go/apierr"
"github.com/databricks/databricks-sdk-go/service/sharing"
"github.com/databricks/terraform-provider-databricks/common"
pluginfwcommon "github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common"
Expand Down Expand Up @@ -60,6 +61,10 @@ func (d *ShareDataSource) Read(ctx context.Context, req datasource.ReadRequest,
IncludeSharedData: true,
})
if err != nil {
if apierr.IsMissing(err) {
resp.State.RemoveResource(ctx)
}

resp.Diagnostics.AddError("Failed to fetch share", err.Error())
return
}
Expand Down

0 comments on commit 7e28bac

Please sign in to comment.