Open wcislo-saleor opened 1 year ago
I just noticed that Keycloak 20 is not supported.
I haven't tested Keycloak 20 yet but I should be able to confirm that it works with this provider and update the matrix that I test with. In any case, provider panics are always a bug, so thanks for opening this issue.
FWIW (I have no idea about programming in Go)
By looking at the stack trace it seems that a variable is assumed to be not null but in fact is. I adjusted my resource definition and with the following steps I was able to stop this panic from happening.
permissions {
view = []
edit = []
}
to
permissions {
view = [“admin”, “user”]
edit = []
}
terraform apply
terraform apply
If this helps in any way, I encountered the same issue by doing following.
smtp_server
settings with Terraform (including auth
block).terraform apply
terraform apply
@wcislo-saleor Would you mind if I ask you some offtopic questions:
occupation
and location
besides having all other normal fields as you can see it here: https://github.com/kasir-barati/you-say/blob/main/keycloak/user-profile.tf but now I soloy have this in my registration page:
I found the answer with a bit of patience and reading the doc. Of course google was not useful at all even for showing me the official documentation. I used lovely Tor to find it. BTW here is what I understood and what I did regarding testing it and making sure that it is the way I should do it:
When you create an attribute, no permission is set to the attribute. Effectively, the attribute won’t be accessible by either users or administrators. Once you create the attribute, make sure to set the permissions accordingly to that the attribute is only visible by the target audience. (Ref)
Here is my final terraform code:
resource "keycloak_realm_user_profile" "you-say-user-profile" {
realm_id = keycloak_realm.you-say-realm.id
attribute {
name = "firstName"
display_name = "$${firstName}"
permissions {
view = ["admin", "user"]
edit = ["admin", "user"]
}
validator {
name = "person-name-prohibited-characters"
config = {}
}
validator {
name = "length"
config = {
"min" : 2,
"max" : 255
}
}
}
attribute {
name = "lastName"
display_name = "$${lastName}"
permissions {
view = ["admin", "user"]
edit = ["admin", "user"]
}
validator {
name = "person-name-prohibited-characters"
config = {}
}
validator {
name = "length"
config = {
"min" : 2,
"max" : 255
}
}
}
attribute {
name = "occupation"
display_name = "$${occupation}"
permissions {
view = ["admin", "user"]
edit = ["admin", "user"]
}
validator {
name = "pattern"
config = {
pattern = "^[a-zA-Z0-9_][a-zA-Z0-9_ ]*[a-zA-Z0-9_]$"
error-message = "Please use only characters and space between words, And do not start or end your occupation with white space"
}
}
}
attribute {
name = "location"
display_name = "$${location}"
validator {
name = "pattern"
config = {
pattern = "^[a-zA-Z\u0080-\u024F]+(?:. |-| |')*([1-9a-zA-Z\u0080-\u024F]+(?:. |-| |'))*[a-zA-Z\u0080-\u024F]*$"
error-message = "Please enter a valid city name followed by the country name. e.x. Tokyo, Japan"
}
}
}
}
Terraform:
v1.3.9
terraform-provider-keycloak:4.2.0
Keycloak:20.0.3
Resource definition:
Error:
If there is anything else I could provide to help investigate please let me know.