mrparkers / terraform-provider-keycloak

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

Question: Does it support to create an identity provider to authenticate with github? #780

Open mattcui opened 1 year ago

mattcui commented 1 year ago

Currently, we can manually configure Keycloak to do authentication with Github, but seems that terraform-provider-keycloak can't support to create it currently, right? Thanks.

janvasiljevic commented 1 year ago

There is no direct resource for the Github IDP, but you can do it with the keycloak_oidc_identity_provider. Didn't find any direct documentation on it anywhere, except directly in the source code.

I got it working like this:

resource "keycloak_oidc_identity_provider" "github_idp" {
  realm = keycloak_realm.realm.id
  alias = "github"
  provider_id = "github"
  display_name = "GitHub"
  enabled = true

  client_id     = ""
  client_secret = ""

  authorization_url = "https://github.com/login/oauth/authorize"
  token_url         = "https://github.com/login/oauth/access_token"
  user_info_url     = "https://api.github.com/user"
  default_scopes    = "user:email"
}