Can not set Service Principal User role to a service principal

jgrycz
New Contributor III

Hi!

I'm trying to assign `Service Principal Users` role to a newly create Service Principal using terraform.

For that I use following block of code:

```

resource "databricks_service_principal_role" "sp_job_runner_user_role" {
  service_principal_id = databricks_service_principal.sp_job_runner.id
  role = "roles/servicePrincipal.user"
}
```
Terraform complains with following error when I execute `terraform apply`:
```
Error: cannot create service principal role: invalidValue Invalid role value roles/servicePrincipal.user
```

What's the valid role name I should use?

I would like to do the same thing as on the below image:

Screenshot 2024-11-13 at 15.30.56.png
 
I need that SP to run a databricks jobs, but without that role I'm unable to assign this SP in the `run_as` field because of this error:
```
Error: cannot update job: Cannot bind the service principal provided in 'run_as' field (.....) to the job. The user creating or updating the job must have 'servicePrincipal.user' role on the service principal.
```