Fix spurious grants create for empty grants list on direct engine#6039
Open
radakam wants to merge 2 commits into
Open
Fix spurious grants create for empty grants list on direct engine#6039radakam wants to merge 2 commits into
radakam wants to merge 2 commits into
Conversation
An empty grants: [] list produced no databricks_grants resource in terraform state, so bundle deployment migrate wrote no grants entry. The direct engine's makePlan then always emitted a plan node for the grants config node, so bundle plan showed a spurious 'create' for the empty grants node -- contradicting migrate's 'no actions planned'. Skip an empty grants node in makePlan when there is no existing state entry. When a state entry exists (grants were deployed and are now being emptied), the node is still emitted so the revoke is planned.
radakam
marked this pull request as ready for review
July 23, 2026 13:14
Contributor
Approval status: pending
|
Collaborator
Integration test reportCommit: e444cc7
8 interesting tests: 4 RECOVERED, 4 SKIP
Top 3 slowest tests (at least 2 minutes):
|
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.
Changes
Skip an empty
grants: []node in the direct engine'smakePlanwhen there is no state entry for it. State-aware: if a grants entry already exists, the node is kept so emptying a previously-deployed list still plans the revoke.Why
Terraform writes no
databricks_grantsresource for an empty grants list, sobundle deployment migraterecords no state for the grants node. ButmakePlanemitted a node for every grants config unconditionally, sobundle planshowed a spuriousgrants -> create, contradicting migrate's "no actions planned" (migrate itself succeeds; it's the migrate → plan invariant that breaks).Permissions avoid this because an empty
permissions: []either drops the node or (with #6046) defaults to a realIS_OWNERresource. Grants have no default owner, so the Terraform-faithful behavior for an empty list is a no-op — hence a state-aware skip rather than a mutator or injected default.Found by fuzz testing.
Tests
acceptance/bundle/migrate/grants-empty.