While experimenting with service accounts, I've noticed I can't seem to assign roles to them.
The exact error message is the following:
╷
│ Error: error sending POST request to /admin/realms/realm/users/3cd0450f-d016-4274-8e77-6047f0051e67/role-mappings/clients/675aec76-d9ec-45b9-aceb-0355625050ae: 404 Not Found. Response body: {"error":"Role not found"}
│
│ with keycloak_openid_client_service_account_role.client_service_account_role,
│ on test.tf line 39, in resource "keycloak_openid_client_service_account_role" "client_service_account_role":
│ 39: resource "keycloak_openid_client_service_account_role" "client_service_account_role" {
│
╵
I get this error consistently with the following Terraform and provider versions:
I believe the error comes from the body of the request being [{"id":"","name":"11e0515c-f064-4a79-b224-68ec5d9ee065","description":""}] where the API would expect [{"id":"11e0515c-f064-4a79-b224-68ec5d9ee065","name":"","description":""}]
This reads like a simple fix for which I'll attempt to open a PR.
Nevermind, It's a user error. Of course, as per the documentation, it's the role's name, and not its Id, that should be used when assigning it to a service account.
Hello!
While experimenting with service accounts, I've noticed I can't seem to assign roles to them. The exact error message is the following:
I get this error consistently with the following Terraform and provider versions:
Using this repo's local environment as set-up by
make local
Here's a minimal set-up allowing to demonstrate the issue for both realm and client role assignments:
Both of the assignments fail with 404s. Looking at TRACE logs, we see the following (once for each assignment):
I believe the error comes from the body of the request being
[{"id":"","name":"11e0515c-f064-4a79-b224-68ec5d9ee065","description":""}]
where the API would expect[{"id":"11e0515c-f064-4a79-b224-68ec5d9ee065","name":"","description":""}]
This reads like a simple fix for which I'll attempt to open a PR.