Skip to content

Commit 60b7aef

Browse files
Suggest bundle.engine config alternative in direct-only resource error (#5295)
## Changes Update the error emitted by `ValidateDirectOnlyResources` (raised when a direct-only resource type — catalogs, external locations, vector search endpoints — is declared while running with the terraform engine) to mention both ways of switching to the direct engine: > Please set the `DATABRICKS_BUNDLE_ENGINE` environment variable to 'direct' **or set `bundle.engine: direct` in your databricks.yml** to use ... resources. ## Why The previous wording only pointed users at the env var. `bundle.engine` is the equivalent (and usually more durable) configuration knob, so mentioning it makes the error actionable for users who prefer to declare engine choice in `databricks.yml` instead of plumbing an env var through their workflow. ## Tests - `go test ./bundle/config/mutator/ -run TestValidateDirectOnlyResources` — unit tests updated to assert the new message. - `go test ./acceptance -run TestAccept/bundle/validate/catalog_requires_direct_mode` — acceptance snapshot updated. - `./task fmt`, `./task checks`, `./task lint` — clean. _This PR was written by Claude Code._
1 parent 9411b84 commit 60b7aef

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
### CLI
88

99
### Bundles
10+
* The error reported when a direct-only resource (catalogs, external locations, vector search endpoints) is used with the terraform engine now also suggests setting `bundle.engine: direct` in `databricks.yml`, in addition to the `DATABRICKS_BUNDLE_ENGINE` environment variable ([#5295](https://github.com/databricks/cli/pull/5295)).

acceptance/bundle/validate/catalog_requires_direct_mode/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Error: Catalog resources are only supported with direct deployment mode
22
in databricks.yml:6:5
33

4-
Catalog resources require direct deployment mode. Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' to use catalog resources.
4+
Catalog resources require direct deployment mode. Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' or set 'bundle.engine: direct' in your databricks.yml to use catalog resources.
55
Learn more at https://docs.databricks.com/dev-tools/bundles/direct
66

77

bundle/config/mutator/validate_direct_only_resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (m *validateDirectOnlyResources) Apply(ctx context.Context, b *bundle.Bundl
5151
Severity: diag.Error,
5252
Summary: group.Description.SingularTitle + " resources are only supported with direct deployment mode",
5353
Detail: fmt.Sprintf("%s resources require direct deployment mode. "+
54-
"Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' to use %s resources.\n"+
54+
"Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' or set 'bundle.engine: direct' in your databricks.yml to use %s resources.\n"+
5555
"Learn more at https://docs.databricks.com/dev-tools/bundles/direct",
5656
group.Description.SingularTitle, group.Description.SingularName),
5757
Locations: b.Config.GetLocations("resources." + group.Description.PluralName),

bundle/config/mutator/validate_direct_only_resources_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestValidateDirectOnlyResourcesTerraformEngineDirectOnlyEmitsError(t *testi
6161
},
6262
expectedSummary: "Catalog resources are only supported with direct deployment mode",
6363
expectedDetail: "Catalog resources require direct deployment mode. " +
64-
"Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' to use catalog resources.\n" +
64+
"Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' or set 'bundle.engine: direct' in your databricks.yml to use catalog resources.\n" +
6565
"Learn more at https://docs.databricks.com/dev-tools/bundles/direct",
6666
},
6767
{
@@ -77,7 +77,7 @@ func TestValidateDirectOnlyResourcesTerraformEngineDirectOnlyEmitsError(t *testi
7777
},
7878
expectedSummary: "External Location resources are only supported with direct deployment mode",
7979
expectedDetail: "External Location resources require direct deployment mode. " +
80-
"Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' to use external_location resources.\n" +
80+
"Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' or set 'bundle.engine: direct' in your databricks.yml to use external_location resources.\n" +
8181
"Learn more at https://docs.databricks.com/dev-tools/bundles/direct",
8282
},
8383
{
@@ -93,7 +93,7 @@ func TestValidateDirectOnlyResourcesTerraformEngineDirectOnlyEmitsError(t *testi
9393
},
9494
expectedSummary: "Vector Search Endpoint resources are only supported with direct deployment mode",
9595
expectedDetail: "Vector Search Endpoint resources require direct deployment mode. " +
96-
"Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' to use vector_search_endpoint resources.\n" +
96+
"Please set the DATABRICKS_BUNDLE_ENGINE environment variable to 'direct' or set 'bundle.engine: direct' in your databricks.yml to use vector_search_endpoint resources.\n" +
9797
"Learn more at https://docs.databricks.com/dev-tools/bundles/direct",
9898
},
9999
}

0 commit comments

Comments
 (0)