Skip to content

[Fix] Tolerate databricks_permissions resources for SQL warehouses with /warehouses/... IDs#4158

Merged
mgyucht merged 1 commit intomainfrom
issue-4143
Oct 28, 2024
Merged

[Fix] Tolerate databricks_permissions resources for SQL warehouses with /warehouses/... IDs#4158
mgyucht merged 1 commit intomainfrom
issue-4143

Conversation

@mgyucht
Copy link
Copy Markdown
Contributor

@mgyucht mgyucht commented Oct 25, 2024

Changes

#4143 reported a regression to the databricks_permissions resource caused by #3956. Normally, the ID for this resource when configured for a SQL warehouse is /sql/warehouses/<ID>. However, it seems like at some point in the past, some users may have had an ID of /warehouses/<ID>. It's possible that importing this resource worked like this: when calling the permissions REST API, whether using object type sql/warehouses or warehouses, the API returns permissions for the same resources:

15:13:01 DEBUG GET /api/2.0/permissions/sql/warehouses/<ID>
< HTTP/2.0 200 OK
< {
<   "access_control_list": [
<     {
<       "all_permissions": [
<         {
<           "inherited": false,
<           "permission_level": "IS_OWNER"
<         }
<       ],
<       "display_name": "<ME>",
<       "user_name": "<ME>"
<     },
<     {
<       "all_permissions": [
<         {
<           "inherited": true,
<           "inherited_from_object": [
<             "/sql/warehouses/"
<           ],
<           "permission_level": "CAN_MANAGE"
<         }
<       ],
<       "group_name": "admins"
<     }
<   ],
<   "object_id": "/sql/warehouses/<ID>",
<   "object_type": "warehouses"
< } pid=53287 sdk=true
...
15:12:56 DEBUG GET /api/2.0/permissions/warehouses/<ID>
< HTTP/2.0 200 OK
< {
<   "access_control_list": [
<     {
<       "all_permissions": [
<         {
<           "inherited": false,
<           "permission_level": "IS_OWNER"
<         }
<       ],
<       "display_name": "<ME>",
<       "user_name": "<ME>"
<     },
<     {
<       "all_permissions": [
<         {
<           "inherited": true,
<           "inherited_from_object": [
<             "/sql/warehouses/"
<           ],
<           "permission_level": "CAN_MANAGE"
<         }
<       ],
<       "group_name": "admins"
<     }
<   ],
<   "object_id": "/sql/warehouses/<ID>",
<   "object_type": "warehouses"
< } pid=53248 sdk=true

This PR modifies the SQL warehouse configuration for databricks_permissions to be chosen for instances with an ID of the form /warehouses/....

Tests

The additional integration test ensures that a resource can be imported with the /warehouses/<ID> format.

@mgyucht mgyucht requested review from a team as code owners October 25, 2024 13:14
@mgyucht mgyucht requested review from rauchy and removed request for a team October 25, 2024 13:14
@mgyucht mgyucht temporarily deployed to test-trigger-is October 25, 2024 13:15 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

Test Details: go/deco-tests/11518956399

Comment on lines +620 to +625
tags {
custom_tags {
key = "Owner"
value = "eng-dev-ecosystem-team_at_databricks.com"
}
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test wasn't running locally before I added this. I'm not sure how it ran before. Our account requires the Owner tag, so this allows the test to run.

@mgyucht mgyucht added this pull request to the merge queue Oct 28, 2024
Merged via the queue into main with commit e504790 Oct 28, 2024
@mgyucht mgyucht deleted the issue-4143 branch October 28, 2024 10:25
mgyucht added a commit that referenced this pull request Oct 28, 2024
### Bug Fixes

 * Recreate missing system schema  ([#4068](#4068)).
 * Tolerate `databricks_permissions` resources for SQL warehouses with `/warehouses/...` IDs ([#4158](#4158)).

### Documentation

 * Fix `databricks_grant` regarding metastore_id description ([#4164](#4164)).

### Internal Changes

 * Automatically trigger integration tests on PR ([#4149](#4149)).

### Exporter

 * **Breaking change** Use new query and alert resources instead of legacy resources ([#4150](#4150)).
 * Improve exporting of `databricks_pipeline` resources ([#4142](#4142)).
 * Improving reliability of `Emit` function ([#4163](#4163)).
mgyucht added a commit that referenced this pull request Oct 28, 2024
### Bug Fixes

 * Recreate missing system schema  ([#4068](#4068)).
 * Tolerate `databricks_permissions` resources for SQL warehouses with `/warehouses/...` IDs ([#4158](#4158)).

### Documentation

 * Fix `databricks_grant` regarding metastore_id description ([#4164](#4164)).

### Internal Changes

 * Automatically trigger integration tests on PR ([#4149](#4149)).

### Exporter

 * **Breaking change** Use new query and alert resources instead of legacy resources ([#4150](#4150)).
 * Improve exporting of `databricks_pipeline` resources ([#4142](#4142)).
 * Improving reliability of `Emit` function ([#4163](#4163)).
github-merge-queue bot pushed a commit that referenced this pull request Oct 28, 2024
### Bug Fixes

* Recreate missing system schema
([#4068](#4068)).
* Tolerate `databricks_permissions` resources for SQL warehouses with
`/warehouses/...` IDs
([#4158](#4158)).


### Documentation

* Fix `databricks_grant` regarding metastore_id description
([#4164](#4164)).


### Internal Changes

* Automatically trigger integration tests on PR
([#4149](#4149)).


### Exporter

* **Breaking change** Use new query and alert resources instead of
legacy resources
([#4150](#4150)).
* Improve exporting of `databricks_pipeline` resources
([#4142](#4142)).
* Improving reliability of `Emit` function
([#4163](#4163)).
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.

4 participants