Skip to content
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

[Fix] Cluster permission to use ClusterId not JobId. #1818

Closed

Conversation

mpreisser-poi
Copy link

Changes

Playing around with the possibility to deploy shared clusters, which was released in v0.229.0 (#1698) it was observed that shared clusters cannot be exposed to other users/service principals/groups by setting appropriate permissions. Debugging this, we found that the produced terraform databricks_permission resource configuration provides the object id through the job_id parameter where the cluster_id parameter would be required, see terraform databricks cluster permissions documentation.

Changing from JobId to ClusterId for the permissions object in bundle/deploy/terraform/tfdyn/convert_cluster.go fixes the observed problem.

Note: It is unclear if further changes are required for consistency. bunde/permissions/mutator.go includes structures which do not include clusters at all. Since no issue was observed for the test below, it was concluded that this part of the code is most likely only relevant for top-level permission assignments.

Tests

Manual test by deploying a shared cluster using a service principle and making it accessible to another user by explicitly setting permissions to one group which the user belongs to. Example:

resource:
     clusters:
         test_cluster:
            cluster_name: dab_test_cluster
            spark_version: 14.3.x-scala2.12
            node_type_id: Standard_D3_v2
            data_security_mode: USER_ISOLATION
            runtime_engine: STANDARD
            autotermination_minutes: 15
            autoscale:
              min_workers: 1
              max_workers: 1
            permissions:
            - group_name: test_group
              level: CAN_ATTACH_TO

@andrewnester
Copy link
Contributor

@mpreisser-poi Thank you for this contribution!

We require a CLA to accept contributions. If you're open to signing one, could you send an email to [email protected] with a topic "Signing CLA for Github contribution", and we'll kickstart the process.

@@ -40,7 +40,7 @@ func (clusterConverter) Convert(ctx context.Context, key string, vin dyn.Value,

// Configure permissions for this resource.
if permissions := convertPermissionsResource(ctx, vin); permissions != nil {
permissions.JobId = fmt.Sprintf("${databricks_cluster.%s.id}", key)
permissions.ClusterId = fmt.Sprintf("${databricks_cluster.%s.id}", key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch! :) convert_clusters_test needs to be updated as well to assert for ClusterId and JobId as it does now

@mpreisser-poi
Copy link
Author

@andrewnester: Thank you for your feedback! For now I am not able to contribute beyond submitting this trivial patch and only wanted to raise attention to this topic. Because of that I will not go forward with the process of signing the CLA. Thanks again..

@andrewnester
Copy link
Contributor

No worries, thanks for the PR anyway, going to close this one in favor of a new PR #1826

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants