From e794a41d040ae1f33d63f8889a70e3aed5d45f3f Mon Sep 17 00:00:00 2001 From: Patrick Decat Date: Mon, 17 Jun 2019 17:05:06 +0200 Subject: [PATCH] Sort IAM policy bindings' members to get simpler diffs as it's what the API does --- google/data_source_google_iam_policy.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/google/data_source_google_iam_policy.go b/google/data_source_google_iam_policy.go index ce78fee81df..a2dd6237ab0 100644 --- a/google/data_source_google_iam_policy.go +++ b/google/data_source_google_iam_policy.go @@ -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, } }