mrparkers / terraform-provider-keycloak

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

keycloak_openid_client_scope is not setting Assigned Type field #776

Open tp20165 opened 1 year ago

tp20165 commented 1 year ago

In the Master realm, I am generating client scope using keycloak_openid_client_scope resource. It created scope with Assigned Type as None. I need to set it as Default. I don't see any option to set the assigned type. Am I missing anything?

mrohlof-protofy commented 1 year ago

I need this, too. Seems like in https://github.com/mrparkers/terraform-provider-keycloak/blob/10e59625b45741464ca3c34a3fba07011981e6a5/provider/resource_keycloak_openid_client_scope.go, the type field is missing.

This way, we can not create scopes that are default for every new client - which is a pain.

klauserber commented 1 year ago

It would be fine to have that.

I use keycloak_openid_client_default_scopes to set default client scopes für single clients like this:

resource "keycloak_openid_client_default_scopes" "client_default_scopes" {
  realm_id  = keycloak_realm.isium.id
  client_id = keycloak_openid_client.weave.id

  default_scopes = [
    "acr",
    "profile",
    "email",
    "roles",
    "web-origins",
    keycloak_openid_client_scope.groups_scope.name,
  ]
}
lesaux commented 1 year ago

keycloak_openid_client_default_scopes seems to have no effect for me.

The Assigned type for a custom keycloak_openid_client_scope remains to "None" in the GUI, despite the terraform apply running fine.

francoisauclair911 commented 1 year ago

Just checking if there was some progress on this ?

Thanks!

hameno commented 6 months ago

We also need this...

EDIT1: Looked at the APIs, it looks like you need to use /admin/realms/[realm]/default-optional-client-scopes / /admin/realms/[realm]/default-optional-client-scopes / /admin/realms/[realm]/default-default-client-scopes API, so we could change keycloak_openid_client_optional_scopes and keycloak_openid_client_default_scopes resources to make client_id optional to manage the realm defaults/optionals