1
votes

i am actually working with terraform to create an auth0_connection from a gcp api credentials:

resource "auth0_connection" "my_connection" {
  name                 = "my_connection"
  strategy             = "google-apps"
  is_domain_connection = false
   
  options {
    allowed_audiences = ["myDomain.com"]
    scopes            = ["email", "profile"]
    api_enable_users  = true
    
  }
}

But I get this error

400 Bad Request: undefined is not a valid google apps domain

I know that I have to add the domain but when I added to options it doesn't work for me.

Should I add a config in auth0 account with default domain or I should add a config in gcp?

1

1 Answers

1
votes

As per the ref from terraform.io your auth0 account may be pre-configured with a google-oauth2 connection. With google-oauth2 connection strategy, options support the following arguments:

resource "auth0_connection" "google_oauth2" {
  name = "Google-OAuth2-Connection"
  strategy = "google-oauth2"
  options {
    client_id = "<client-id>"
    client_secret = "<client-secret>"
    allowed_audiences = [ "example.com", "api.example.com" ]
    scopes = [ "email", "profile", "gmail", "youtube" ]
    set_user_root_attributes = "on_each_login"
  }
}