terraform-provider-keycloak
terraform-provider-keycloak copied to clipboard
Add Social Identity Providers
@mrparkers, first of all thank you very much for this great provider!
Actually I never used a provider before where importing existing stuff and including new resources worked that flawlessly!
The only thing I'm missing currently is the ability to config those pre defined "Social Identity Providers", that may would be a nice enhancement.
Best Peter
Hi @peter-fe,
I'm so happy to hear that the provider has been working well for you.
If you happen to need the Google identity provider, then the good news is that this resource is actually supported by this terraform provider, it just isn't documented. https://github.com/mrparkers/terraform-provider-keycloak/blob/master/provider/resource_keycloak_oidc_google_identity_provider.go
If not, could you let me know which identity providers you're looking to use?
Thanks!
Hi @mrparkers,
You nailed it (once more), it's the Google one I was looking for ;). Thx for the link I'll give it a try.
Best Peter
Awesome! Just to give a quick example, here's the simple configuration that my current employer uses with their GSuite logins:
resource "keycloak_oidc_google_identity_provider" "google" {
realm = keycloak_realm.realm.id
client_id = var.google_identity_provider_client_id
client_secret = var.google_identity_provider_client_secret
trust_email = true
hosted_domain = "liatrio.com"
}
If you need more than that, the schema for this resource is the result of merging the schema for the link I posted above, and the schema for the generic identity provider, found here: https://github.com/mrparkers/terraform-provider-keycloak/blob/master/provider/generic_keycloak_identity_provider.go
Great! I Think that's perfect!
Hey @mrparkers,
Worked like a charm! Thank you!
resource "keycloak_oidc_google_identity_provider" "google" {
realm = keycloak_realm.realm.id
client_id = "<redacted>"
client_secret = "<redacted>"
trust_email = true
store_token = false
hosted_domain = "example.com"
extra_config = {
"syncMode" = "IMPORT"
}
}
@mrparkers I am trying to use keycloak_oidc_google_identity_provider
but seems like google
hard coded value for Alias
is not allowing it to be used for Microsoft identity provider.
Is there anyway to configure it for Microsoft identity provider?
@mrparkers Anyways, I managed Microsoft SSO using key-cloak OIDC resource.
@mrparkers would there be by any chance a github identity provider also available but not documented?
Turns out there's some magic when the identity provider has "github" as an alias & provider_id :)
resource "keycloak_oidc_identity_provider" "github" {
realm = keycloak_realm.test-realm.realm
alias = "github"
provider_id = "github"
client_id = "<client-id>"
client_secret = "<client-secret>"
token_url = ""
authorization_url = ""
add_read_token_role_on_create = true
backchannel_supported = false
default_scopes = "read:user read:org user:email"
}
If you are missing any variable, you can add them via
extra_config = {
otherParm = "value"
}