Skip to content

Commit bdc50ea

Browse files
authored
[DOCS] added example of granting Account Admin role to a service principal (#4807)
## Changes <!-- Summary of your changes that are easy to understand --> This PR makes changes to docs only, no code changes. The `databricks_service_principal_role` is capable of giving account admin role to a service principal; however, this was not very clear in the docs whereas we do have an example given in `databricks_user_role` for users. I added an example demonstrating this capability of setting `role = "account_admin"` and a note that it can only be used with an account-level provider. ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [X] relevant change in `docs/` folder
1 parent ba2eac6 commit bdc50ea

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Document `tags` attribute in `databricks_pipeline` resource ([#4783](https://github.com/databricks/terraform-provider-databricks/pull/4783)).
2121
* Recommend OAuth instead of PAT in guides ([#4787](https://github.com/databricks/terraform-provider-databricks/pull/4787))
2222
* Document new options in `databricks_model_serving` resource ([#4789](https://github.com/databricks/terraform-provider-databricks/pull/4789))
23+
* Added example of granting Account Admin role with `databricks_service_principal_role` resource ([#4807](https://github.com/databricks/terraform-provider-databricks/pull/4807))
2324

2425
### Exporter
2526

docs/resources/service_principal_role.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,27 @@ resource "databricks_service_principal_role" "my_service_principal_instance_prof
2626
}
2727
```
2828

29+
Granting a service principal the Account Admin role.
30+
31+
-> This can only be used with an account-level provider.
32+
33+
```hcl
34+
resource "databricks_service_principal" "tf_admin" {
35+
display_name = "Terraform Admin"
36+
}
37+
38+
resource "databricks_service_principal_role" "tf_admin_account" {
39+
service_principal_id = databricks_service_principal.tf_admin.id
40+
role = "account_admin"
41+
}
42+
```
43+
2944
## Argument Reference
3045

3146
The following arguments are supported:
3247

3348
* `service_principal_id` - (Required) This is the id of the [service principal](service_principal.md) resource.
34-
* `role` - (Required) This is the id of the role or [instance profile](instance_profile.md) resource.
49+
* `role` - (Required) This is the role name, role id, or [instance profile](instance_profile.md) resource.
3550

3651
## Attribute Reference
3752

@@ -52,3 +67,4 @@ The following resources are often used in the same context:
5267
* [databricks_group_instance_profile](group_instance_profile.md) to attach [databricks_instance_profile](instance_profile.md) (AWS) to [databricks_group](group.md).
5368
* [databricks_group_member](group_member.md) to attach [users](user.md) and [groups](group.md) as group members.
5469
* [databricks_instance_profile](instance_profile.md) to manage AWS EC2 instance profiles that users can launch [databricks_cluster](cluster.md) and access data, like [databricks_mount](mount.md).
70+
* [databricks_access_control_rule_set](access_control_rule_set.md#grant_rules) to attach other roles to account level resources.

0 commit comments

Comments
 (0)