mrparkers / terraform-provider-keycloak

Terraform provider for Keycloak
https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs
MIT License
598 stars 292 forks source link

Unable to add realm client roles to new client as a composite #900

Closed boocorn closed 7 months ago

boocorn commented 8 months ago

Hi all

I am trying to add the realm-management create-client role to a client role as a composite as shown:

data "keycloak_openid_client" "realm_management" {
  realm_id = keycloak_realm.test.id
  client_id = "realm-management"

}

resource "keycloak_role" "client_role_test" {
  realm_id  = keycloak_realm.test.id
  client_id = keycloak_openid_client.test.id
  name        = "test-client-role"
  description = "Manage test only"

 composite_roles = [data.keycloak_openid_client.realm_management.id]

}

I get the following error - module.keycloak.keycloak_role.client_role_test: Creating... ╷ │ Error: error sending GET request to /admin/realms/test/roles-by-id/58020282-6e3f-42cd-af54-1bf96cbd8d7f: 404 Not Found. Response body: {"error":"Could not find role with id"} │ │ with module.keycloak.keycloak_role.client_role_test, │ on keycloak\b-test-client.tf line 56, in resource "keycloak_role" "client_role_test": │ 56: resource "keycloak_role" "client_role_test" { │

I also want to use the composite roles in realm-managaement such as create-client. Is there a way to do this instead?

Thanks

boocorn commented 7 months ago

Withdrawing issue as no longer applicable