Skip to content

Add declarative bind for direct deployment engine#4630

Draft
shreyas-goenka wants to merge 1 commit intomainfrom
declarative-import
Draft

Add declarative bind for direct deployment engine#4630
shreyas-goenka wants to merge 1 commit intomainfrom
declarative-import

Conversation

@shreyas-goenka
Copy link
Copy Markdown
Contributor

@shreyas-goenka shreyas-goenka commented Mar 2, 2026

Summary

Add declarative bind blocks under a target so users can bring existing
workspace resources under bundle management at deploy time without
manually running bundle deployment bind. Direct engine only — bind
blocks under the terraform engine, in bundle deployment migrate, or
under bundle destroy (when the bind matches a resource currently in
state) all surface actionable errors.

targets:
  default:
    bind:
      jobs:
        my_job:
          id: "12345"

Two new actions show up in bundle plan:

  • bind — resource is imported, no field changes
  • bind_and_update — resource is imported, drift is applied

Design

  • Bind config type and bind field on Target in bundle/config,
    plus a structural validator that rejects child resources
    (*.permissions, *.grants).
  • Bind logic is isolated in bundle/direct/bundle_plan_bind.go
    DeploymentBundle.ApplyBindToPlan runs after CalculatePlan,
    validates references, detects ID conflicts, reads remote state, and
    selects Bind vs BindAndUpdate per resource. CalculatePlan itself
    is unchanged.
  • DeploymentUnit.DeclarativeBind apply path persists the bound ID
    (and invokes DoUpdate for BindAndUpdate).
  • Targeted error in libs/dyn/convert/normalize.go for bind placed at
    the root level (otherwise it would silently degrade to an "unknown
    field" warning).

Test plan

Acceptance coverage in acceptance/bundle/deploy/bind/:

  • Happy path: basic, bind-and-update
  • Validation errors: invalid-resource-type, orphaned-bind,
    top-level-bind, duplicate-bind-id, terraform-with-bind,
    bind-permissions
  • Runtime errors: resource-not-found, recreate-blocked
  • Lifecycle guards: block-migrate, destroy-blocked,
    delete-and-bind-conflict

Unit tests for bundle/config/bind.go,
bundle/config/mutator/validate_bind_resources.go, and the new
normalize-time error in libs/dyn/convert/normalize.go.

This pull request and its description were written by Isaac.

@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

eng-dev-ecosystem-bot commented Mar 2, 2026

Commit: feb7bb2

Run: 23122374940

Env 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 8 7 268 800 6:11
💚​ aws windows 8 7 270 798 4:28
🔄​ aws-ucws linux 2 7 7 364 715 7:12
🔄​ aws-ucws windows 2 7 7 366 713 6:19
💚​ azure linux 2 9 271 798 4:52
💚​ azure windows 2 9 273 796 5:44
🔄​ azure-ucws linux 2 1 9 369 711 7:33
🔄​ azure-ucws windows 2 1 9 371 709 6:28
💚​ gcp linux 2 9 267 801 5:53
💚​ gcp windows 2 9 269 799 4:51
16 interesting tests: 7 SKIP, 6 RECOVERED, 3 flaky
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🔄​ TestAccept 💚​R 💚​R 🔄​f 💚​R 💚​R 💚​R 🔄​f 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestAccept/ssh/connect-serverless-gpu 🙈​s 🙈​s 🔄​f 🔄​f 🙈​s 🙈​s 🔄​f 🔄​f 🙈​s 🙈​s
🔄​ TestAccept/ssh/connection 💚​R 💚​R 💚​R 🔄​f 💚​R 💚​R 💚​R 🔄​f 💚​R 💚​R
Top 20 slowest tests (at least 2 minutes):
duration env testname
3:47 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:42 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:38 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:15 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:15 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:15 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:08 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:50 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:49 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:46 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:46 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:40 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:38 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:36 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:35 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:33 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:14 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:08 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:07 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:00 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct

@shreyas-goenka shreyas-goenka marked this pull request as draft March 3, 2026 09:05
@shreyas-goenka shreyas-goenka changed the title Add declarative import for direct deployment engine Add declarative bind for direct deployment engine Mar 5, 2026
Allow users to bring existing workspace resources under bundle management
declaratively via `bind` blocks under a target. Adds:

- `Bind` config type and `bind` field on `Target` in `bundle/config`,
  with a structural validator that rejects child resources
  (`*.permissions`, `*.grants`).
- `Bind` and `BindAndUpdate` action types in the deploy plan, surfaced
  in `bundle plan` output (and in the summary as "N to bind").
- `DeploymentBundle.ApplyBindToPlan` (in `bundle/direct/bundle_plan_bind.go`),
  which runs after `CalculatePlan`, validates bind references, detects
  bind-ID/state-ID conflicts, and reads remote state to choose
  `Bind` vs `BindAndUpdate` per resource.
- `DeploymentUnit.DeclarativeBind` apply path that persists the bound ID
  (and optionally invokes `DoUpdate` for `BindAndUpdate`).
- Targeted error in `libs/dyn/convert/normalize.go` for `bind` placed at
  the root level.
- Rejection of bind blocks in the terraform path (`RunPlan`),
  `bundle deployment migrate`, and `bundle destroy` when the bind
  matches a resource currently in state.

Acceptance coverage in `acceptance/bundle/deploy/bind/` covers the
happy path (basic, bind_and_update), validation errors (invalid
resource type, orphaned bind, top-level bind, duplicate id, terraform
engine, child resources), runtime errors (resource not found, recreate
blocked), and the destroy / migrate guards.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Isaac
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