Skip to content

Commit

Permalink
Add missing field set_user_root_attributes to auth0 connection (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught authored Aug 26, 2022
1 parent 0c4f30d commit 4e9ce4d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion internal/provider/resource_auth0_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ func TestAccConnection(t *testing.T) {
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.brute_force_protection", "false"),
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.mfa.0.return_enroll_settings", "false"),
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.upstream_params", ""),
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.enabled_database_customization", "true"),
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.set_user_root_attributes", "on_first_login"),
),
},
},
Expand Down Expand Up @@ -175,7 +177,8 @@ resource "auth0_connection" "my_connection" {
password_no_personal_info {
enable = true
}
enabled_database_customization = false
enabled_database_customization = true
set_user_root_attributes = "on_first_login"
brute_force_protection = false
import_mode = false
disable_signup = false
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/structure_auth0_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func flattenConnectionOptionsAuth0(d ResourceData, options *management.Connectio
"custom_scripts": options.CustomScripts,
"configuration": Map(d, "options.0.configuration"), // does not get read back
"non_persistent_attrs": options.GetNonPersistentAttrs(),
"set_user_root_attributes": options.GetSetUserAttributes(),
}

if options.PasswordComplexityOptions != nil {
Expand Down Expand Up @@ -649,6 +650,7 @@ func expandConnectionOptionsAuth0(d ResourceData) (*management.ConnectionOptions
options := &management.ConnectionOptions{
PasswordPolicy: String(d, "password_policy"),
NonPersistentAttrs: castToListOfStrings(Set(d, "non_persistent_attrs").List()),
SetUserAttributes: String(d, "set_user_root_attributes"),
}

List(d, "validation").Elem(func(d ResourceData) {
Expand Down
6 changes: 3 additions & 3 deletions test/data/recordings/TestAccConnection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ interactions:
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/connections/con_QpRZXwUduHKEGdJP
method: PATCH
response:
body: '{"id":"con_QpRZXwUduHKEGdJP","options":{"mfa":{"active":true,"return_enroll_settings":false},"import_mode":false,"configuration":{"foo":"2.0$c093f4779d2dabf49617ebe6fd6ea3a8$ea46dfbbe4f971491f8fe2a51fabd3ff$ffceec6a68430196fb435c8f1d6717a3d535eadc8ef36468a64181b119484f50"},"customScripts":{"get_user":"myFunction"},"disable_signup":false,"passwordPolicy":"fair","password_history":{"size":5,"enable":true},"requires_username":true,"password_dictionary":{"enable":true,"dictionary":["password","admin","1234"]},"non_persistent_attrs":null,"brute_force_protection":false,"password_no_personal_info":{"enable":true},"password_complexity_options":{"min_length":6},"enabledDatabaseCustomization":false},"strategy":"auth0","name":"Acceptance-Test-Connection-TestAccConnection","is_domain_connection":true,"enabled_clients":[],"realms":["Acceptance-Test-Connection-TestAccConnection"],"metadata":{"key1":"foo","key2":"bar"}}'
body: '{"id":"con_QpRZXwUduHKEGdJP","options":{"mfa":{"active":true,"return_enroll_settings":false},"import_mode":false,"configuration":{"foo":"2.0$c093f4779d2dabf49617ebe6fd6ea3a8$ea46dfbbe4f971491f8fe2a51fabd3ff$ffceec6a68430196fb435c8f1d6717a3d535eadc8ef36468a64181b119484f50"},"customScripts":{"get_user":"myFunction"},"disable_signup":false,"passwordPolicy":"fair","password_history":{"size":5,"enable":true},"requires_username":true,"password_dictionary":{"enable":true,"dictionary":["password","admin","1234"]},"non_persistent_attrs":null,"brute_force_protection":false,"password_no_personal_info":{"enable":true},"password_complexity_options":{"min_length":6},"enabledDatabaseCustomization":true,"set_user_root_attributes":"on_first_login"},"strategy":"auth0","name":"Acceptance-Test-Connection-TestAccConnection","is_domain_connection":true,"enabled_clients":[],"realms":["Acceptance-Test-Connection-TestAccConnection"],"metadata":{"key1":"foo","key2":"bar"}}'
headers:
Content-Type:
- application/json; charset=utf-8
Expand All @@ -108,7 +108,7 @@ interactions:
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/connections/con_QpRZXwUduHKEGdJP
method: GET
response:
body: '{"id":"con_QpRZXwUduHKEGdJP","options":{"mfa":{"active":true,"return_enroll_settings":false},"import_mode":false,"configuration":{"foo":"2.0$c093f4779d2dabf49617ebe6fd6ea3a8$ea46dfbbe4f971491f8fe2a51fabd3ff$ffceec6a68430196fb435c8f1d6717a3d535eadc8ef36468a64181b119484f50"},"customScripts":{"get_user":"myFunction"},"disable_signup":false,"passwordPolicy":"fair","password_history":{"size":5,"enable":true},"requires_username":true,"password_dictionary":{"enable":true,"dictionary":["password","admin","1234"]},"non_persistent_attrs":null,"brute_force_protection":false,"password_no_personal_info":{"enable":true},"password_complexity_options":{"min_length":6},"enabledDatabaseCustomization":false},"strategy":"auth0","name":"Acceptance-Test-Connection-TestAccConnection","is_domain_connection":true,"enabled_clients":[],"realms":["Acceptance-Test-Connection-TestAccConnection"],"metadata":{"key1":"foo","key2":"bar"}}'
body: '{"id":"con_QpRZXwUduHKEGdJP","options":{"mfa":{"active":true,"return_enroll_settings":false},"import_mode":false,"configuration":{"foo":"2.0$c093f4779d2dabf49617ebe6fd6ea3a8$ea46dfbbe4f971491f8fe2a51fabd3ff$ffceec6a68430196fb435c8f1d6717a3d535eadc8ef36468a64181b119484f50"},"customScripts":{"get_user":"myFunction"},"disable_signup":false,"passwordPolicy":"fair","password_history":{"size":5,"enable":true},"requires_username":true,"password_dictionary":{"enable":true,"dictionary":["password","admin","1234"]},"non_persistent_attrs":null,"brute_force_protection":false,"password_no_personal_info":{"enable":true},"password_complexity_options":{"min_length":6},"enabledDatabaseCustomization":true,"set_user_root_attributes":"on_first_login"},"strategy":"auth0","name":"Acceptance-Test-Connection-TestAccConnection","is_domain_connection":true,"enabled_clients":[],"realms":["Acceptance-Test-Connection-TestAccConnection"],"metadata":{"key1":"foo","key2":"bar"}}'
headers:
Content-Type:
- application/json; charset=utf-8
Expand All @@ -127,7 +127,7 @@ interactions:
url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/connections/con_QpRZXwUduHKEGdJP
method: GET
response:
body: '{"id":"con_QpRZXwUduHKEGdJP","options":{"mfa":{"active":true,"return_enroll_settings":false},"import_mode":false,"configuration":{"foo":"2.0$c093f4779d2dabf49617ebe6fd6ea3a8$ea46dfbbe4f971491f8fe2a51fabd3ff$ffceec6a68430196fb435c8f1d6717a3d535eadc8ef36468a64181b119484f50"},"customScripts":{"get_user":"myFunction"},"disable_signup":false,"passwordPolicy":"fair","password_history":{"size":5,"enable":true},"requires_username":true,"password_dictionary":{"enable":true,"dictionary":["password","admin","1234"]},"non_persistent_attrs":null,"brute_force_protection":false,"password_no_personal_info":{"enable":true},"password_complexity_options":{"min_length":6},"enabledDatabaseCustomization":false},"strategy":"auth0","name":"Acceptance-Test-Connection-TestAccConnection","is_domain_connection":true,"enabled_clients":[],"realms":["Acceptance-Test-Connection-TestAccConnection"],"metadata":{"key1":"foo","key2":"bar"}}'
body: '{"id":"con_QpRZXwUduHKEGdJP","options":{"mfa":{"active":true,"return_enroll_settings":false},"import_mode":false,"configuration":{"foo":"2.0$c093f4779d2dabf49617ebe6fd6ea3a8$ea46dfbbe4f971491f8fe2a51fabd3ff$ffceec6a68430196fb435c8f1d6717a3d535eadc8ef36468a64181b119484f50"},"customScripts":{"get_user":"myFunction"},"disable_signup":false,"passwordPolicy":"fair","password_history":{"size":5,"enable":true},"requires_username":true,"password_dictionary":{"enable":true,"dictionary":["password","admin","1234"]},"non_persistent_attrs":null,"brute_force_protection":false,"password_no_personal_info":{"enable":true},"password_complexity_options":{"min_length":6},"enabledDatabaseCustomization":true,"set_user_root_attributes":"on_first_login"},"strategy":"auth0","name":"Acceptance-Test-Connection-TestAccConnection","is_domain_connection":true,"enabled_clients":[],"realms":["Acceptance-Test-Connection-TestAccConnection"],"metadata":{"key1":"foo","key2":"bar"}}'
headers:
Content-Type:
- application/json; charset=utf-8
Expand Down

0 comments on commit 4e9ce4d

Please sign in to comment.