Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
sort connection.enabled_clients
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkappa committed Aug 6, 2018
1 parent 15c597f commit f1fccd9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion auth0/resource_auth0_connection.go
@@ -1,6 +1,8 @@
package auth0

import (
"sort"

"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/yieldr/go-auth0/management"
Expand Down Expand Up @@ -116,6 +118,7 @@ func newConnection() *schema.Resource {
"brute_force_protection": {
Type: schema.TypeBool,
Optional: true,
Default: true,
},
"import_mode": {
Type: schema.TypeBool,
Expand Down Expand Up @@ -183,6 +186,11 @@ func readConnection(d *schema.ResourceData, m interface{}) error {
"disable_signup": c.Options.DisableSignup,
},
})

sort.Slice(c.EnabledClients, func(i, j int) bool {
return c.EnabledClients[i].(string) > c.EnabledClients[j].(string)
})

d.Set("enabled_clients", c.EnabledClients)
d.Set("realms", c.Realms)
return nil
Expand Down Expand Up @@ -215,11 +223,11 @@ func buildConnection(d *schema.ResourceData) *management.Connection {
}

if v, ok := d.GetOk("options"); ok {

vL := v.([]interface{})
for _, v := range vL {

if options, ok := v.(map[string]interface{}); ok {

c.Options = &management.ConnectionOptions{
Validation: options["validation"].(map[string]interface{}),
PasswordPolicy: options["password_policy"].(string),
Expand Down

0 comments on commit f1fccd9

Please sign in to comment.