Skip to content

Commit

Permalink
Sort IAM policy bindings' members to get simpler diffs as it's what t…
Browse files Browse the repository at this point in the history
…he API does
  • Loading branch information
pdecat committed Jun 19, 2019
1 parent c54b2cd commit fc25f8a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion google/data_source_google_iam_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,14 @@ func dataSourceGoogleIamPolicyRead(d *schema.ResourceData, meta interface{}) err
// Convert each config binding into a cloudresourcemanager.Binding
for i, v := range bset.List() {
binding := v.(map[string]interface{})
members := convertStringSet(binding["members"].(*schema.Set))

// Sort members to get simpler diffs as it's what the API does
sort.Strings(members)

policy.Bindings[i] = &cloudresourcemanager.Binding{
Role: binding["role"].(string),
Members: convertStringSet(binding["members"].(*schema.Set)),
Members: members,
}
}

Expand Down

0 comments on commit fc25f8a

Please sign in to comment.