Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0aa470d
Use EmbeddedSlice for GrantsState; add state migration v2→v3
denik Mar 16, 2026
c400e04
Update acceptance test outputs for grants EmbeddedSlice change
denik Mar 16, 2026
0966914
Update acceptance test outputs for state_version 3
denik Mar 16, 2026
9860e3b
Regenerate acceptance test outputs after rebase
denik Mar 16, 2026
b38e9b3
Regenerate remaining acceptance test outputs after rebase
denik Mar 16, 2026
27775b0
Fix permissions jobs update test output divergence
denik Mar 16, 2026
f7ec34c
Fix classic combinations test output
denik Mar 16, 2026
6cbfcf4
Fix remaining acceptance test output divergences from rebase
denik Mar 16, 2026
e3ead8e
Fix more acceptance test output divergences from rebase
denik Mar 16, 2026
86d100c
Fix interactive_cluster_dynamic_version test output
denik Mar 16, 2026
41cecdb
__embed__
denik Mar 17, 2026
120d5f9
Revert state version to 2, remove v2→v3 migration entry
denik Mar 17, 2026
ee31590
Keep grants JSON key as "grants", remove dead v2→v3 migration
denik Mar 17, 2026
660ba02
Regenerate acceptance test outputs for grants JSON key change
denik Mar 17, 2026
1b076e3
Remove trailing newline in migrate.go, revert unrelated apps/run-loca…
denik Mar 17, 2026
12febe7
Remove unrelated out.run.txt from apps/run-local test
denik Mar 17, 2026
2ee041d
clean up
denik Mar 17, 2026
bb38e74
Add KeyedSlices to ResourceGrants for key-based diff comparison
denik Mar 17, 2026
31ec046
use __embed__
denik Mar 17, 2026
ff0ec59
Remove KeyedSlices from grants, add state migration v2→v3
denik Mar 17, 2026
fd4e2eb
Update acceptance test outputs for state version 3 and __embed__ key
denik Mar 17, 2026
ca9ee3f
Regenerate acceptance test outputs for state version 3 and __embed__ …
denik Mar 17, 2026
3051895
Add unit tests for grants state migration v2→v3
denik Mar 17, 2026
d730227
Fix lint issue in migration test
denik Mar 17, 2026
4ab7cac
Fold grants migration into v1→v2, remove state version 3
denik Mar 17, 2026
969fef1
Regenerate acceptance test outputs for state version 2
denik Mar 17, 2026
4c97697
update test out
denik Mar 17, 2026
d084530
clean up
denik Mar 18, 2026
2effbee
Fix AGENT TODOs in dstate/migrate.go
denik Mar 18, 2026
971ddf3
Revert sortPriviliges to use sort.Slice
denik Mar 18, 2026
75edb0e
Remove redundant early-return checks in migration functions
denik Mar 18, 2026
ed528f7
Use json.Marshal instead of json.MarshalIndent in migration
denik Mar 18, 2026
512d20f
Replace make+copy with direct assignment in migrateGrantsEntry
denik Mar 18, 2026
b27d743
add a comment
denik Mar 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions acceptance/bundle/invariant/configs/schema_grant_ref.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
bundle:
name: test-bundle-$UNIQUE_NAME

resources:
schemas:
schema_b:
catalog_name: main
name: test-schema-b-$UNIQUE_NAME
grants:
- principal: account users
privileges:
- USE_SCHEMA
- principal: admins
privileges:
- CREATE_TABLE
- USE_SCHEMA

schema_a:
catalog_name: main
name: test-schema-a-$UNIQUE_NAME
grants:
# Reference principal and privileges from schema_b by index
- principal: ${resources.schemas.schema_b.grants[0].principal}
privileges:
- USE_SCHEMA
- principal: ${resources.schemas.schema_b.grants[1].principal}
privileges:
- CREATE_TABLE
12 changes: 12 additions & 0 deletions acceptance/bundle/invariant/configs/schema_with_grants.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
bundle:
name: test-bundle-$UNIQUE_NAME

resources:
schemas:
foo:
catalog_name: main
name: test-schema-$UNIQUE_NAME
grants:
- principal: account users
privileges:
- USE_SCHEMA
2 changes: 1 addition & 1 deletion acceptance/bundle/invariant/continue_293/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions acceptance/bundle/invariant/continue_293/test.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Cloud = false
Slow = true

# Cross-resource permission references (${resources.jobs.X.permissions[N].field}) require
# permissions to be part of the job schema, which was added after v0.293.0.
# $resources references to permissions and grants are not supported on v0.293.0
EnvMatrixExclude.no_permission_ref = ["INPUT_CONFIG=job_permission_ref.yml.tmpl"]
EnvMatrixExclude.no_cross_resource_ref = ["INPUT_CONFIG=job_cross_resource_ref.yml.tmpl"]
EnvMatrixExclude.no_grant_ref = ["INPUT_CONFIG=schema_grant_ref.yml.tmpl"]
2 changes: 1 addition & 1 deletion acceptance/bundle/invariant/migrate/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions acceptance/bundle/invariant/migrate/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ EnvMatrixExclude.no_secret_scope = ["INPUT_CONFIG=secret_scope.yml.tmpl"]
# ends up as the permission level value.
EnvMatrixExclude.no_permission_ref = ["INPUT_CONFIG=job_permission_ref.yml.tmpl"]
EnvMatrixExclude.no_cross_resource_ref = ["INPUT_CONFIG=job_cross_resource_ref.yml.tmpl"]

# Grant cross-references require the EmbeddedSlice pattern not present in terraform mode.
EnvMatrixExclude.no_grant_ref = ["INPUT_CONFIG=schema_grant_ref.yml.tmpl"]
2 changes: 1 addition & 1 deletion acceptance/bundle/invariant/no_drift/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions acceptance/bundle/invariant/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ EnvMatrix.INPUT_CONFIG = [
"postgres_project.yml.tmpl",
"registered_model.yml.tmpl",
"schema.yml.tmpl",
"schema_grant_ref.yml.tmpl",
"schema_with_grants.yml.tmpl",
"secret_scope.yml.tmpl",
"synced_database_table.yml.tmpl",
"volume.yml.tmpl",
Expand Down
6 changes: 3 additions & 3 deletions acceptance/bundle/migrate/grants/out.new_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"state": {
"securable_type": "function",
"full_name": "main.schema_grants.mymodel",
"grants": [
"__embed__": [
{
"principal": "deco-test-user@databricks.com",
"privileges": [
Expand Down Expand Up @@ -52,7 +52,7 @@
"state": {
"securable_type": "schema",
"full_name": "main.schema_grants",
"grants": [
"__embed__": [
{
"principal": "deco-test-user@databricks.com",
"privileges": [
Expand Down Expand Up @@ -89,7 +89,7 @@
"state": {
"securable_type": "volume",
"full_name": "main.schema_grants.volume_name",
"grants": [
"__embed__": [
{
"principal": "deco-test-user@databricks.com",
"privileges": [
Expand Down
20 changes: 20 additions & 0 deletions acceptance/bundle/refschema/out.fields.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ resources.catalogs.*.updated_by string REMOTE
resources.catalogs.*.url string INPUT
resources.catalogs.*.grants.full_name string ALL
resources.catalogs.*.grants.securable_type string ALL
resources.catalogs.*.grants[*] catalog.PrivilegeAssignment ALL
resources.catalogs.*.grants[*].principal string ALL
resources.catalogs.*.grants[*].privileges []catalog.Privilege ALL
resources.catalogs.*.grants[*].privileges[*] catalog.Privilege ALL
resources.clusters.*.apply_policy_default_values bool INPUT STATE
resources.clusters.*.autoscale *compute.AutoScale ALL
resources.clusters.*.autoscale.max_workers int ALL
Expand Down Expand Up @@ -683,6 +687,10 @@ resources.external_locations.*.updated_by string REMOTE
resources.external_locations.*.url string ALL
resources.external_locations.*.grants.full_name string ALL
resources.external_locations.*.grants.securable_type string ALL
resources.external_locations.*.grants[*] catalog.PrivilegeAssignment ALL
resources.external_locations.*.grants[*].principal string ALL
resources.external_locations.*.grants[*].privileges []catalog.Privilege ALL
resources.external_locations.*.grants[*].privileges[*] catalog.Privilege ALL
resources.jobs.*.budget_policy_id string ALL
resources.jobs.*.continuous *jobs.Continuous ALL
resources.jobs.*.continuous.pause_status jobs.PauseStatus ALL
Expand Down Expand Up @@ -2680,6 +2688,10 @@ resources.registered_models.*.updated_by string ALL
resources.registered_models.*.url string INPUT
resources.registered_models.*.grants.full_name string ALL
resources.registered_models.*.grants.securable_type string ALL
resources.registered_models.*.grants[*] catalog.PrivilegeAssignment ALL
resources.registered_models.*.grants[*].principal string ALL
resources.registered_models.*.grants[*].privileges []catalog.Privilege ALL
resources.registered_models.*.grants[*].privileges[*] catalog.Privilege ALL
resources.schemas.*.browse_only bool REMOTE
resources.schemas.*.catalog_name string ALL
resources.schemas.*.catalog_type catalog.CatalogType REMOTE
Expand Down Expand Up @@ -2709,6 +2721,10 @@ resources.schemas.*.updated_by string REMOTE
resources.schemas.*.url string INPUT
resources.schemas.*.grants.full_name string ALL
resources.schemas.*.grants.securable_type string ALL
resources.schemas.*.grants[*] catalog.PrivilegeAssignment ALL
resources.schemas.*.grants[*].principal string ALL
resources.schemas.*.grants[*].privileges []catalog.Privilege ALL
resources.schemas.*.grants[*].privileges[*] catalog.Privilege ALL
resources.secret_scopes.*.backend_azure_keyvault *workspace.AzureKeyVaultSecretScopeMetadata STATE
resources.secret_scopes.*.backend_azure_keyvault.dns_name string STATE
resources.secret_scopes.*.backend_azure_keyvault.resource_id string STATE
Expand Down Expand Up @@ -2871,3 +2887,7 @@ resources.volumes.*.volume_id string REMOTE
resources.volumes.*.volume_type catalog.VolumeType ALL
resources.volumes.*.grants.full_name string ALL
resources.volumes.*.grants.securable_type string ALL
resources.volumes.*.grants[*] catalog.PrivilegeAssignment ALL
resources.volumes.*.grants[*].principal string ALL
resources.volumes.*.grants[*].privileges []catalog.Privilege ALL
resources.volumes.*.grants[*].privileges[*] catalog.Privilege ALL
31 changes: 31 additions & 0 deletions acceptance/bundle/resource_deps/grant_ref/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
bundle:
name: test-bundle

resources:
schemas:
# schema_b has grants that schema_a references
schema_b:
catalog_name: main
name: schema B
grants:
- principal: viewers
privileges:
- USE_SCHEMA
- principal: editors
privileges:
- CREATE_TABLE
- USE_SCHEMA

# schema_a references schema_b's grant principals
schema_a:
catalog_name: main
name: schema A
grants:
# Reference by integer index
- principal: ${resources.schemas.schema_b.grants[0].principal}
privileges:
- USE_SCHEMA
# Reference by integer index (second entry)
- principal: ${resources.schemas.schema_b.grants[1].principal}
privileges:
- CREATE_TABLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"plan_version": 2,
"cli_version": "[DEV_VERSION]",
"plan": {
"resources.schemas.schema_a": {
"action": "create",
"new_state": {
"value": {
"catalog_name": "main",
"name": "schema A"
}
}
},
"resources.schemas.schema_a.grants": {
"depends_on": [
{
"node": "resources.schemas.schema_a",
"label": "${resources.schemas.schema_a.id}"
},
{
"node": "resources.schemas.schema_b.grants",
"label": "${resources.schemas.schema_b.grants[0].principal}"
},
{
"node": "resources.schemas.schema_b.grants",
"label": "${resources.schemas.schema_b.grants[1].principal}"
}
],
"action": "create",
"new_state": {
"value": {
"securable_type": "schema",
"full_name": "",
"__embed__": [
{
"principal": "viewers",
"privileges": [
"USE_SCHEMA"
]
},
{
"principal": "editors",
"privileges": [
"CREATE_TABLE"
]
}
]
},
"vars": {
"full_name": "${resources.schemas.schema_a.id}"
}
}
},
"resources.schemas.schema_b": {
"action": "create",
"new_state": {
"value": {
"catalog_name": "main",
"name": "schema B"
}
}
},
"resources.schemas.schema_b.grants": {
"depends_on": [
{
"node": "resources.schemas.schema_b",
"label": "${resources.schemas.schema_b.id}"
}
],
"action": "create",
"new_state": {
"value": {
"securable_type": "schema",
"full_name": "",
"__embed__": [
{
"principal": "viewers",
"privileges": [
"USE_SCHEMA"
]
},
{
"principal": "editors",
"privileges": [
"CREATE_TABLE",
"USE_SCHEMA"
]
}
]
},
"vars": {
"full_name": "${resources.schemas.schema_b.id}"
}
}
}
}
}
5 changes: 5 additions & 0 deletions acceptance/bundle/resource_deps/grant_ref/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions acceptance/bundle/resource_deps/grant_ref/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

>>> [CLI] bundle plan
create schemas.schema_a
create schemas.schema_a.grants
create schemas.schema_b
create schemas.schema_b.grants

Plan: 4 to add, 0 to change, 0 to delete, 0 unchanged

>>> [CLI] bundle plan -o json

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!
4 changes: 4 additions & 0 deletions acceptance/bundle/resource_deps/grant_ref/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

trace $CLI bundle plan
trace $CLI bundle plan -o json > out.plan_create.$DATABRICKS_BUNDLE_ENGINE.json
trace $CLI bundle deploy
4 changes: 4 additions & 0 deletions acceptance/bundle/resource_deps/grant_ref/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RecordRequests = false

[EnvMatrix]
DATABRICKS_BUNDLE_ENGINE = ["direct"]
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"new_state": {
"value": {
"full_name": "",
"grants": [
"__embed__": [
{
"principal": "deco-test-user@databricks.com",
"privileges": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"new_state": {
"value": {
"full_name": "catalog_grants_[UNIQUE_NAME]",
"grants": [
"__embed__": [
{
"principal": "deco-test-user@databricks.com",
"privileges": [
Expand All @@ -38,7 +38,7 @@
},
"remote_state": {
"full_name": "catalog_grants_[UNIQUE_NAME]",
"grants": [
"__embed__": [
{
"principal": "deco-test-user@databricks.com",
"privileges": [
Expand All @@ -49,13 +49,13 @@
]
},
"changes": {
"grants[0].privileges[0]": {
"[0].privileges[0]": {
"action": "update",
"old": "CREATE_SCHEMA",
"new": "USE_CATALOG",
"remote": "CREATE_SCHEMA"
},
"grants[0].privileges[1]": {
"[0].privileges[1]": {
"action": "update",
"old": "USE_CATALOG",
"new": "USE_SCHEMA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"value": {
"securable_type": "function",
"full_name": "",
"grants": [
"__embed__": [
{
"principal": "deco-test-user@databricks.com",
"privileges": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"value": {
"securable_type": "schema",
"full_name": "",
"grants": [
"__embed__": [
{
"principal": "deco-test-user@databricks.com",
"privileges": [
Expand Down
Loading
Loading