Add declarative bind for direct deployment engine#4630
Draft
shreyas-goenka wants to merge 14 commits intomainfrom
Draft
Add declarative bind for direct deployment engine#4630shreyas-goenka wants to merge 14 commits intomainfrom
shreyas-goenka wants to merge 14 commits intomainfrom
Conversation
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>
Collaborator
|
Commit: 0146951
18 interesting tests: 7 SKIP, 6 RECOVERED, 5 flaky
Top 18 slowest tests (at least 2 minutes):
|
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>
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>
- 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>
f7ad1f2 to
34f8a49
Compare
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>
Two proposals:
1. Replace regex-based ${...} parsing with a proper two-mode character scanner
2. Add "did you mean?" suggestions for invalid variable references
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extends the bind-and-update acceptance test to verify that the action type transitions from "bind" on the first deploy to "update" on subsequent deploys after the resource is already bound in state. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two changes: 1. Destroy validation: bundle destroy now errors when bind blocks in the target configuration reference resources tracked in the deployment state. This prevents accidentally deleting pre-existing workspace resources that were imported via bind. Users must remove the bind blocks or run 'bundle deployment unbind' before destroying. 2. Bind plan logic: use an explicit switch on the max action type during bind planning. Only Update and Resize map to BindAndUpdate. Recreate and UpdateWithID produce user-facing errors. Any other action type (e.g. Create, Delete) is treated as an internal error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bindblocks to target configuration, allowing users to bind existing workspace resources (jobs, pipelines, etc.) into bundle management at deploy timebind(no config changes) andbind_and_update(bind + apply changes)bundle deployment migratewhen bind blocks are defined, since they are only supported with the direct engineBindas a dynamicmap[string]map[string]BindResourcetype that automatically supports all resource typesTest plan
acceptance/bundle/deploy/bind/basic)acceptance/bundle/deploy/bind/bind-and-update)acceptance/bundle/deploy/bind/block-migrate)acceptance/bundle/deploy/bind/resource-not-found)acceptance/bundle/deploy/bind/orphaned-bind)acceptance/bundle/deploy/bind/recreate-blocked)acceptance/bundle/deploy/bind/terraform-with-bind)🤖 Generated with Claude Code