diff --git a/auth0/resource_auth0_connection_test.go b/auth0/resource_auth0_connection_test.go index 431e5d59..e1265cc7 100644 --- a/auth0/resource_auth0_connection_test.go +++ b/auth0/resource_auth0_connection_test.go @@ -22,7 +22,7 @@ func TestAccConnection(t *testing.T) { resource.TestCheckResourceAttr("auth0_connection.my_connection", "strategy", "auth0"), resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.password_policy", "fair"), resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.password_no_personal_info.0.enable", "true"), - resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.enabled_database_customization", "false"), + resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.enabled_database_customization", "true"), resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.brute_force_protection", "true"), resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.import_mode", "true"), resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.disable_signup", "false"), @@ -57,7 +57,7 @@ resource "auth0_connection" "my_connection" { password_no_personal_info { enable = true } - enabled_database_customization = false + enabled_database_customization = true brute_force_protection = true import_mode = true disable_signup = false @@ -88,7 +88,7 @@ resource "auth0_connection" "my_connection" { password_no_personal_info { enable = true } - enabled_database_customization = false + enabled_database_customization = true brute_force_protection = false import_mode = true disable_signup = false diff --git a/auth0/resource_auth0_user.go b/auth0/resource_auth0_user.go index 11892779..6b36c855 100644 --- a/auth0/resource_auth0_user.go +++ b/auth0/resource_auth0_user.go @@ -93,11 +93,11 @@ func readUser(d *schema.ResourceData, m interface{}) error { d.Set("verify_email", u.VerifyEmail) d.Set("email", u.Email) - if userMeta, err := structure.FlattenJsonToString(u.UserMetadata); err != nil { + if userMeta, err := structure.FlattenJsonToString(u.UserMetadata); err == nil { d.Set("user_metadata", userMeta) } - if appMeta, err := structure.FlattenJsonToString(u.AppMetadata); err != nil { + if appMeta, err := structure.FlattenJsonToString(u.AppMetadata); err == nil { d.Set("app_metadata", appMeta) } @@ -144,14 +144,14 @@ func buildUser(d *schema.ResourceData) *management.User { if d.HasChange("user_metadata") { userMeta, err := structure.ExpandJsonFromString(d.Get("user_metadata").(string)) - if err != nil { + if err == nil { u.UserMetadata = userMeta } } if d.HasChange("app_metadata") { appMeta, err := structure.ExpandJsonFromString(d.Get("app_metadata").(string)) - if err != nil { + if err == nil { u.AppMetadata = appMeta } } diff --git a/auth0/resource_auth0_user_test.go b/auth0/resource_auth0_user_test.go index 58c14ec0..29c5dee3 100644 --- a/auth0/resource_auth0_user_test.go +++ b/auth0/resource_auth0_user_test.go @@ -49,8 +49,7 @@ func TestAccUserCreateUser(t *testing.T) { } const testAccUserCreateUser = ` -provider "auth0" { -} +provider "auth0" {} resource "auth0_user" "user" { connection_name = "Username-Password-Authentication" @@ -59,17 +58,7 @@ resource "auth0_user" "user" { email = "test@test.com" password = "passpass$12$12" nickname = "testnick" - user_metadata = <