Skip to content

Add declarative bind for direct deployment engine#4630

Draft
shreyas-goenka wants to merge 10 commits intomainfrom
declarative-import
Draft

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

Conversation

@shreyas-goenka
Copy link
Contributor

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

Summary

  • Add bind blocks to target configuration, allowing users to bind existing workspace resources (jobs, pipelines, etc.) into bundle management at deploy time
  • Support two bind action types: pure bind (no config changes) and bind_and_update (bind + apply changes)
  • Block bundle deployment migrate when bind blocks are defined, since they are only supported with the direct engine
  • Implement Bind as a dynamic map[string]map[string]BindResource type that automatically supports all resource types

Test plan

  • Acceptance test: basic bind of an existing job (acceptance/bundle/deploy/bind/basic)
  • Acceptance test: bind + update job name in same deploy (acceptance/bundle/deploy/bind/bind-and-update)
  • Acceptance test: migration blocked with bind blocks (acceptance/bundle/deploy/bind/block-migrate)
  • Acceptance test: error when binding non-existent resource (acceptance/bundle/deploy/bind/resource-not-found)
  • Acceptance test: orphaned bind detection (acceptance/bundle/deploy/bind/orphaned-bind)
  • Acceptance test: recreate blocked for bound resources (acceptance/bundle/deploy/bind/recreate-blocked)
  • Acceptance test: terraform engine rejects bind blocks (acceptance/bundle/deploy/bind/terraform-with-bind)
  • All tests pass locally and on cloud

🤖 Generated with Claude Code

Allow users to import existing workspace resources into bundle management
at deploy time using import blocks in target configuration. This is
analogous to Terraform's import blocks and enables taking over management
of resources without recreating them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@eng-dev-ecosystem-bot
Copy link
Collaborator

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

Commit: afbc6ee

Run: 22742123576

Env 🪲​BUG ❌​FAIL 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 8 7 268 790 7:17
💚​ aws windows 8 7 270 788 5:40
💚​ aws-ucws linux 8 7 365 705 12:24
💚​ aws-ucws windows 8 7 367 703 12:06
🪲​ azure linux 1 8 1 1 9 262 788 145:59
🪲​ azure windows 1 8 1 1 9 264 786 144:45
🪲​ azure-ucws linux 1 8 1 2 9 360 701 149:30
🪲​ azure-ucws windows 1 8 1 1 1 9 362 699 146:10
🪲​ gcp linux 1 8 1 1 9 258 791 145:38
🪲​ gcp windows 1 8 1 1 9 260 789 144:25
25 interesting tests: 8 FAIL, 7 SKIP, 6 RECOVERED, 2 flaky, 1 KNOWN, 1 BUG
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 💚​R 💚​R 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K
🪲​ TestAccept/bundle/deployment/bind/alert 🙈​s 🙈​s 🙈​s 🙈​s 🪲​B 🪲​B 🪲​B 🪲​B 🪲​B 🪲​B
❌​ TestAccept/bundle/deployment/bind/alert/DATABRICKS_BUNDLE_ENGINE=direct ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/deployment/bind/alert/DATABRICKS_BUNDLE_ENGINE=terraform ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/generate/alert ✅​p ✅​p ✅​p ✅​p ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/generate/alert/DATABRICKS_BUNDLE_ENGINE=direct ✅​p ✅​p ✅​p ✅​p ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/generate/alert/DATABRICKS_BUNDLE_ENGINE=terraform ✅​p ✅​p ✅​p ✅​p ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/resources/alerts/with_file ✅​p ✅​p ✅​p ✅​p ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/resources/alerts/with_file/DATABRICKS_BUNDLE_ENGINE=direct ✅​p ✅​p ✅​p ✅​p ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
❌​ TestAccept/bundle/resources/alerts/with_file/DATABRICKS_BUNDLE_ENGINE=terraform ✅​p ✅​p ✅​p ✅​p ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
🙈​ 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 ✅​p ✅​p 🙈​s 🙈​s 🔄​f 🔄​f 🙈​s 🙈​s
🔄​ TestAccept/ssh/connection 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 🔄​f 💚​R 💚​R 💚​R
Top 25 slowest tests (at least 2 minutes):
duration env testname
10:20 aws-ucws windows TestAccept/ssh/connection
9:45 aws-ucws linux TestAccept/ssh/connection
8:45 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
8:33 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
4:22 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:16 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
4:15 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:49 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:43 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:37 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:16 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:14 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:03 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:53 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:52 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:46 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:45 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:43 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:42 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:42 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:39 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:37 aws-ucws linux TestAccept
2:35 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:31 aws linux TestAccept
2:18 azure-ucws linux TestAccept/ssh/connect-serverless-gpu

Add validations for:
- Import blocks used with terraform engine (must use direct engine)
- Import blocks referencing undefined resources (orphaned imports)

Add acceptance tests for:
- Recreate blocked for imported resources (changing immutable field)
- Orphaned import blocks (import references non-existent resource)
- Import blocks rejected with terraform engine

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shreyas-goenka shreyas-goenka marked this pull request as draft March 3, 2026 09:05
Rename the "import" configuration block to "bind" throughout the codebase
to better reflect the semantics of binding existing workspace resources
into bundle management.

Also refactor the Bind type from a hardcoded struct with 21 resource type
fields to a dynamic map[string]map[string]BindResource, reducing the
implementation from ~225 lines to ~42 lines and eliminating the need to
update the type when new resource types are added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shreyas-goenka shreyas-goenka changed the title Add declarative import for direct deployment engine Add declarative bind for direct deployment engine Mar 5, 2026
- Move Bind/BindAndUpdate below UpdateWithID but before Create/Recreate/Delete
  in the action severity order
- Add validation that prevents bind and delete conflicts on the same resource ID
- Add acceptance tests:
  - invalid-resource-type: bind references a non-existent resource type
  - top-level-bind: bind placed at root level instead of under target
  - delete-and-bind-conflict: bind ID matches a resource being deleted

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace plain error messages with diag.Diagnostic that includes Locations
and Paths pointing to the bind block in the YAML config. Guard against
nil configRoot when called from destroy path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bind IDs that conflict with existing resources in state are invalid
regardless of the action type (delete, recreate, update_id, etc.).
Check all state entries directly instead of only delete plan entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test that binding a resource ID already managed by another resource in
state is caught, even when the existing resource is not being deleted.
This covers recreate and update_id conflict scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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