|
| 1 | +--- |
| 2 | +subcategory: "Security" |
| 3 | +--- |
| 4 | +# databricks_permission_assignment Resource |
| 5 | + |
| 6 | +These resources are invoked in the workspace context. |
| 7 | + |
| 8 | +## Example Usage |
| 9 | + |
| 10 | +In workspace context, adding account-level user to a workspace: |
| 11 | + |
| 12 | +```hcl |
| 13 | +resource "databricks_user" "me" { |
| 14 | + |
| 15 | +} |
| 16 | +
|
| 17 | +resource "databricks_permission_assignment" "add_user" { |
| 18 | + principal_id = databricks_user.me.id |
| 19 | + permissions = ["USER"] |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +In workspace context, adding account-level service principal to a workspace: |
| 24 | + |
| 25 | +```hcl |
| 26 | +resource "databricks_service_principal" "sp" { |
| 27 | + display_name = "Automation-only SP" |
| 28 | +} |
| 29 | +
|
| 30 | +resource "databricks_permission_assignment" "add_admin_spn" { |
| 31 | + principal_id = databricks_service_principal.sp.id |
| 32 | + permissions = ["ADMIN"] |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +## Argument Reference |
| 37 | + |
| 38 | +The following arguments are required: |
| 39 | + |
| 40 | +* `principal_id` - Databricks ID of the user, service principal, or group. The principal ID can be retrieved using the account-level SCIM API, or using [databricks_user](../data-sources/user.md), [databricks_service_principal](../data-sources/service_principal.md) or [databricks_group](../data-sources/group.md) data sources with account API (and has to be an account admin). A more sensible approach is to retrieve the list of `principal_id` as outputs from another Terraform stack. |
| 41 | +* `permissions` - The list of workspace permissions to assign to the principal: |
| 42 | + * `"USER"` - Can access the workspace with basic privileges. |
| 43 | + * `"ADMIN"` - Can access the workspace and has workspace admin privileges to manage users and groups, workspace configurations, and more. |
| 44 | + |
| 45 | +## Import |
| 46 | + |
| 47 | +The resource `databricks_permission_assignment` can be imported using the principal id |
| 48 | + |
| 49 | +```bash |
| 50 | +terraform import databricks_permission_assignment.this principal_id |
| 51 | +``` |
| 52 | + |
| 53 | +## Related Resources |
| 54 | + |
| 55 | +The following resources are used in the same context: |
| 56 | + |
| 57 | +* [databricks_group](group.md) to manage [groups in Databricks Workspace](https://docs.databricks.com/administration-guide/users-groups/groups.html) or [Account Console](https://accounts.cloud.databricks.com/) (for AWS deployments). |
| 58 | +* [databricks_group](../data-sources/group.md) data to retrieve information about [databricks_group](group.md) members, entitlements and instance profiles. |
| 59 | +* [databricks_group_member](group_member.md) to attach [users](user.md) and [groups](group.md) as group members. |
| 60 | +* [databricks_mws_permission_assignment](mws_permission_assignment.md) to manage permission assignment from an account context |
0 commit comments