Skip to content

Fix bind/unbind to resolve engine from bundle config, not just env var#4894

Merged
denik merged 5 commits intomainfrom
denik/bundle-engine-vs-env
Apr 7, 2026
Merged

Fix bind/unbind to resolve engine from bundle config, not just env var#4894
denik merged 5 commits intomainfrom
denik/bundle-engine-vs-env

Conversation

@denik
Copy link
Copy Markdown
Contributor

@denik denik commented Apr 2, 2026

Changes

  • bind and unbind now resolve the deployment engine from bundle config (bundle.engine), not just the DATABRICKS_BUNDLE_ENGINE env var. This matches how deploy and destroy already work.

Why

When bundle.engine: direct was set in config but the env var was unset, bind would silently create terraform state alongside resources.json, and unbind would fail with "No state file was found!" because it looked for terraform state.

Tests

  • Added acceptance tests for both bind and unbind with bundle.engine: direct in config and no env var set, verifying the engine is resolved from config.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Suggested reviewers

Based on git history of the changed files, these people are best suited to review:

  • @andrewnester -- recent work in cmd/bundle/deployment/, bundle/phases/, cmd/apps/

Confidence: high

Eligible reviewers

Based on CODEOWNERS, these people or teams could also review:

@anton-107, @databricks/eng-apps-devex, @pietern, @shreyas-goenka, @simonfaltum

Suggestions based on git history of 14 changed files (4 scored). See CODEOWNERS for path-specific ownership rules.

denik added 5 commits April 7, 2026 15:37
The bind and unbind commands use engine.FromEnv() which only reads the
DATABRICKS_BUNDLE_ENGINE environment variable. They ignore both the
bundle.engine config setting and existing deployment state.

The bind test shows that after deploying with direct engine (from config),
bind silently creates terraform state alongside direct state.

The unbind test shows that after deploying with direct engine (from config),
unbind fails trying to use terraform because no terraform state exists.

Task: 001.md

Co-authored-by: Isaac
Bind() and Unbind() in bundle/phases/bind.go were calling engine.FromEnv()
which only reads the DATABRICKS_BUNDLE_ENGINE env var. This meant they
ignored the bundle.engine config setting and existing deployment state.

Changed both functions to accept engine.EngineType as a parameter (matching
Deploy()'s pattern), with callers resolving the engine via ProcessBundleRet
which uses ResolveEngineSetting (config > env var > default).

Task: 002.md
Tests now verify correct behavior: bind and unbind use the direct engine
when bundle.engine is set to "direct" in config. Changed EnvMatrix to
["direct"] per task requirements.

Task: 002.md
Change DATABRICKS_BUNDLE_ENGINE from ["direct"] to [] in bind/unbind
engine-from-config tests. With ["direct"], env and config agreed so a
regression back to engine.FromEnv() would still pass. With [], the env
var is unset and the tests verify that bind/unbind read engine from
bundle.engine config.

Task-review: /Users/denis.bilenko/work/prompts/features/bundle-engine-vs-env/003.SUMMARY.md

Co-authored-by: Isaac
@denik denik force-pushed the denik/bundle-engine-vs-env branch from 1276a3a to 7fe8200 Compare April 7, 2026 13:37
@denik denik added this pull request to the merge queue Apr 7, 2026
Merged via the queue into main with commit ff9afcc Apr 7, 2026
18 checks passed
@denik denik deleted the denik/bundle-engine-vs-env branch April 7, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants