Configure "Javascript OpenID Connect Protocol Mapper" (for Keycloak 18) via Terraform

Viewed 121

I want to upgrade to Keycloak 18.0.2. So I have raised the version of the mrparkers/keycloak terraform provider to 3.9.1.

I use "Javascript OpenID Connect Protocol Mapper" to transfer certain information into my JWT tokens: https://www.keycloak.org/docs/latest/server_development/#_script_providers . So the "Javascript OpenID Connect Protocol Mappers" are part of the server installation / Docker image and are not uploaded like they used to be with the Keycloak API.

On the Keycloak admin UI, I can go to "Client Scopes > profile > Mappers > Create" and enter my own written mapper. When I select my self-written mapper as "Mapper Type" the following fields to be filled in appear on the UI:

  • Name
  • Multivalued
  • Token Claim Name
  • Claim JSON Type
  • Add to ID token
  • Add to access token
  • Add to userinfo

Manually this works and the information is transferred to the jwt token as expected.

Now I want the assignment of the mapper to the client scopes to be done via Terraform. I have not found a suitable resource to configure the "Javascript OpenID Connect Protocol Mapper" via Terraform on a client scope. The support for this resource was removed with Keycloak 18: See note in https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs/resources/openid_script_protocol_mapper . I only found the generic client protocol mapper: https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs/resources/generic_client_protocol_mapper But I don't have the possibility to specify the client scope; also the information for which token type (ID token ,access token, userinfo token) the mapper should be used is missing in this resource.

How can I configure my "Javascript OpenID Connect Protocol Mapper" via Terraform?

Thanks in advance!

1 Answers
Related