Skip to content

Fix spurious grants create for empty grants list on direct engine#6039

Open
radakam wants to merge 2 commits into
mainfrom
fix-empty-grants-migrate
Open

Fix spurious grants create for empty grants list on direct engine#6039
radakam wants to merge 2 commits into
mainfrom
fix-empty-grants-migrate

Conversation

@radakam

@radakam radakam commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Changes

Skip an empty grants: [] node in the direct engine's makePlan when 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_grants resource for an empty grants list, so bundle deployment migrate records no state for the grants node. But makePlan emitted a node for every grants config unconditionally, so bundle plan showed a spurious grants -> 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 real IS_OWNER resource. 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

  • New acceptance test acceptance/bundle/migrate/grants-empty.
  • Manually verified end-to-end on dogfood.

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
radakam marked this pull request as ready for review July 23, 2026 13:14
@github-actions

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

6 files changed
Suggested: @denik
Also eligible: @janniklasrose, @pietern, @andrewnester, @shreyas-goenka, @lennartkats-db, @anton-107

/bundle/ - needs approval

Files: bundle/direct/bundle_plan.go
Suggested: @denik
Also eligible: @janniklasrose, @pietern, @andrewnester, @shreyas-goenka, @lennartkats-db, @anton-107

General files (require maintainer)

Files: .nextchanges/bundles/empty-grants-migrate.md
Based on git history:

  • @denik -- recent work in bundle/direct/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: e444cc7

Run: 30009506980

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 322 1060 4:53
💚​ aws windows 4 4 324 1058 7:23
💚​ azure linux 4 4 322 1059 5:04
💚​ azure windows 4 4 324 1057 5:09
💚​ gcp linux 1 5 321 1061 4:58
💚​ gcp windows 1 5 323 1059 5:03
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
6:12 aws windows TestAccept
3:50 azure windows TestAccept
3:27 gcp windows TestAccept

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