Skip to content

Commit 90f48d4

Browse files
authored
[Exporter] Fix crash when importing model serving endpoint (#4806)
## Changes <!-- Summary of your changes that are easy to understand --> It looks like that there are situation when model serving endpoint provisioning failed, then it stays, but have no `config` block, leading to a crash (never seen before). Resolves #4803 ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [x] `make test` run locally - [ ] relevant change in `docs/` folder - [ ] covered with integration tests in `internal/acceptance` - [ ] using Go SDK - [ ] using TF Plugin Framework
1 parent d14ae30 commit 90f48d4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

NEXT_CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@
1919

2020
### Exporter
2121

22+
* Fix crash when importing model serving endpoint ([#4806](https://github.com/databricks/terraform-provider-databricks/pull/4806))
23+
2224
### Internal Changes

exporter/importables.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ var resourcesMap map[string]importable = map[string]importable{
15011501
s := ic.Resources["databricks_model_serving"].Schema
15021502
var mse serving.CreateServingEndpoint
15031503
common.DataToStructPointer(r.Data, s, &mse)
1504-
if mse.Config.ServedEntities != nil {
1504+
if mse.Config != nil {
15051505
for _, se := range mse.Config.ServedEntities {
15061506
if se.EntityName != "" {
15071507
if se.EntityVersion != "" { // we have an UC model or model from model registry
@@ -1549,7 +1549,7 @@ var resourcesMap map[string]importable = map[string]importable{
15491549
}
15501550
}
15511551
}
1552-
if mse.Config.AutoCaptureConfig != nil && mse.Config.AutoCaptureConfig.CatalogName != "" &&
1552+
if mse.Config != nil && mse.Config.AutoCaptureConfig != nil && mse.Config.AutoCaptureConfig.CatalogName != "" &&
15531553
mse.Config.AutoCaptureConfig.SchemaName != "" {
15541554
ic.Emit(&resource{
15551555
Resource: "databricks_schema",

0 commit comments

Comments
 (0)