-
Notifications
You must be signed in to change notification settings - Fork 179
direct: Fix spurious recreate of schemas and volumes with mixed-case names #5531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c5ab8cc
30be520
e59cc1c
4ea89e4
9df55b3
6216b37
0169c0c
858eacf
168bcce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| # Reproduce: UC API normalizes identifier names to lowercase, causing | ||
| # false drift on the second deploy when the config uses mixed-case names. | ||
| # Volumes are covered by acceptance/bundle/resources/volumes/uppercase-name | ||
| # instead: the Terraform provider rejects an uppercase volume schema_name | ||
| # ("inconsistent final plan"), and the migrate invariant always deploys via | ||
| # Terraform first, so an uppercase volume cannot live in this shared config. | ||
| resources: | ||
| schemas: | ||
| foo: | ||
| catalog_name: main | ||
| name: MySCHEMA-$UNIQUE_NAME |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| # Reproduce: the UC API lowercases identifier names, causing false drift on the | ||
| # second deploy when the config uses mixed-case names. This covers a volume's | ||
| # catalog_name, schema_name and name on the direct engine. | ||
| # | ||
| # Excluded from the migrate invariant: that test deploys via Terraform first, | ||
| # and the TF provider rejects an uppercase volume schema_name ("inconsistent | ||
| # final plan"). | ||
| resources: | ||
| schemas: | ||
| foo: | ||
| catalog_name: main | ||
| name: MySCHEMA-$UNIQUE_NAME | ||
|
|
||
| volumes: | ||
| bar: | ||
| catalog_name: main | ||
| schema_name: ${resources.schemas.foo.name} | ||
| name: MyVOL-$UNIQUE_NAME | ||
| volume_type: MANAGED |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bundle: | ||
| name: test-bundle | ||
|
|
||
| resources: | ||
| schemas: | ||
| schema1: | ||
| catalog_name: main | ||
| name: MySCHEMA | ||
|
|
||
| volumes: | ||
| vol1: | ||
| catalog_name: main | ||
| schema_name: MySCHEMA | ||
| name: MyVOLUME | ||
| volume_type: MANAGED |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.1/unity-catalog/schemas", | ||
| "body": { | ||
| "catalog_name": "main", | ||
| "name": "MySCHEMA" | ||
| } | ||
| } | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.1/unity-catalog/volumes", | ||
| "body": { | ||
| "catalog_name": "main", | ||
| "name": "MyVOLUME", | ||
| "schema_name": "MySCHEMA", | ||
| "volume_type": "MANAGED" | ||
| } | ||
| } | ||
| === Bundle summary shows lowercase IDs after UC normalizes names | ||
| { | ||
| "schema_id": "main.myschema", | ||
| "volume_id": "main.myschema.myvolume" | ||
| } | ||
| === Plan on no-op redeploy: mixed-case names are skipped, not recreated | ||
| [ | ||
| { | ||
| "resource": "resources.schemas.schema1", | ||
| "changes": { | ||
| "name": { | ||
| "action": "skip", | ||
| "reason": "uc_case" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "resource": "resources.volumes.vol1", | ||
| "changes": { | ||
| "name": { | ||
| "action": "skip", | ||
| "reason": "uc_case" | ||
| }, | ||
| "schema_name": { | ||
| "action": "skip", | ||
| "reason": "uc_case" | ||
| }, | ||
| "storage_location": { | ||
| "action": "skip", | ||
| "reason": "backend_default" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| === Redeploy without changes - should be a no-op | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files... | ||
| Deploying resources... | ||
| Error: terraform apply: exit status 1 | ||
|
|
||
| Error: Provider produced inconsistent final plan | ||
|
|
||
| When expanding the plan for databricks_volume.vol1 to include new values | ||
| learned so far during apply, provider | ||
| "registry.terraform.io/databricks/databricks" produced an invalid new value | ||
| for .schema_name: was cty.StringVal("MySCHEMA"), but now | ||
| cty.StringVal("myschema"). | ||
|
|
||
| This is a bug in the provider, which should be reported in the provider's own | ||
| issue tracker. | ||
|
|
||
|
|
||
| Updating deployment state... | ||
|
|
||
| Exit code: 1 | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.1/unity-catalog/schemas", | ||
| "body": { | ||
| "catalog_name": "main", | ||
| "name": "MySCHEMA" | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| echo "*" > .gitignore | ||
| errcode $CLI bundle deploy &> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt | ||
| print_requests.py //unity-catalog >> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt | ||
|
|
||
| if [ "$DATABRICKS_BUNDLE_ENGINE" = "direct" ]; then | ||
| echo "=== Bundle summary shows lowercase IDs after UC normalizes names" >> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt | ||
| $CLI bundle summary -o json \ | ||
| | jq '{schema_id: .resources.schemas.schema1.id, volume_id: .resources.volumes.vol1.id}' \ | ||
| >> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt | ||
|
|
||
| echo "=== Plan on no-op redeploy: mixed-case names are skipped, not recreated" >> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt | ||
| $CLI bundle plan -o json \ | ||
| | jq '.plan | to_entries | map({resource: .key, changes: (.value.changes // {} | map_values({action, reason}))})' \ | ||
| >> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt | ||
|
|
||
| echo "=== Redeploy without changes - should be a no-op" >> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt | ||
| # &>> requires bash 4+; macOS CI runs the stock bash 3.2, so use >> ... 2>&1. | ||
| errcode $CLI bundle deploy >> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1 | ||
| print_requests.py //unity-catalog >> out.deploy.$DATABRICKS_BUNDLE_ENGINE.txt | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Cloud = true | ||
| RequiresUnityCatalog = true | ||
|
|
||
| Ignore = [ | ||
| ".databricks", | ||
| ] | ||
|
|
||
| # TF provider fails with "inconsistent final plan" when schema_name contains | ||
| # uppercase letters that UC normalizes to lowercase; exclude from cloud runs. | ||
| [EnvMatrixExclude] | ||
| no_terraform_on_cloud = ["CONFIG_Cloud=true", "DATABRICKS_BUNDLE_ENGINE=terraform"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting; this error doesn't happen for schemas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no