Skip to content

Commit

Permalink
Allow configuring permissions for all MLflow models (#1070)
Browse files Browse the repository at this point in the history
Fixes #1044
  • Loading branch information
nfx authored Jan 28, 2022
1 parent 0633258 commit 41f4d20
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 0.4.7
* Added optional `force` argument to `databricks_group` resource to ignore `cannot create group: Group with name X already exists.` errors and implicitly import the specific group into Terraform state, enforcing entitlements defined in the instance of resource ([#1066](https://github.com/databrickslabs/terraform-provider-databricks/pull/1066)).
* Added support to configure permissions for all MLflow models ([#1044](https://github.com/databrickslabs/terraform-provider-databricks/issues/1044)).
* Fixed `databricks_service_principal` `display_name` update ([#1065](https://github.com/databrickslabs/terraform-provider-databricks/issues/1065)).
* Added documentation for Unity Catalog resources.

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ resource "databricks_permissions" "experiment_usage" {

## MLflow Model usage

Valid [permission levels](https://docs.databricks.com/security/access-control/workspace-acl.html#mlflow-model-permissions-1) for [databricks_mlflow_model](mlflow_model.md) are: `CAN_READ`, `CAN_EDIT`, `CAN_MANAGE_STAGING_VERSIONS`, `CAN_MANAGE_PRODUCTION_VERSIONS`, and `CAN_MANAGE`.
Valid [permission levels](https://docs.databricks.com/security/access-control/workspace-acl.html#mlflow-model-permissions-1) for [databricks_mlflow_model](mlflow_model.md) are: `CAN_READ`, `CAN_EDIT`, `CAN_MANAGE_STAGING_VERSIONS`, `CAN_MANAGE_PRODUCTION_VERSIONS`, and `CAN_MANAGE`. You can also manage permissions for all MLflow models by `registered_model_id = "root"`.

```hcl
resource "databricks_mlflow_model" "this" {
Expand Down
4 changes: 2 additions & 2 deletions permissions/resource_permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ func (a PermissionsAPI) put(objectID string, objectACL AccessControlChangeList)

// Update updates object permissions. Technically, it's using method named SetOrDelete, but here we do more
func (a PermissionsAPI) Update(objectID string, objectACL AccessControlChangeList) error {
if objectID == "/authorization/tokens" {
// Cannot remove admins's CAN_MANAGE permission on tokens
if objectID == "/authorization/tokens" || objectID == "/registered-models/root" {
// Prevent "Cannot change permissions for group 'admins' to None."
objectACL.AccessControlList = append(objectACL.AccessControlList, AccessControlChange{
GroupName: "admins",
PermissionLevel: "CAN_MANAGE",
Expand Down

0 comments on commit 41f4d20

Please sign in to comment.