diff --git a/google/iam.go b/google/iam.go index 53d0e44a2..e9d398b45 100644 --- a/google/iam.go +++ b/google/iam.go @@ -10,6 +10,7 @@ import ( "strings" "time" + "github.com/davecgh/go-spew/spew" "github.com/hashicorp/errwrap" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "google.golang.org/api/cloudresourcemanager/v1" @@ -69,7 +70,7 @@ func iamPolicyReadWithRetry(updater ResourceIamUpdater) (*cloudresourcemanager.P if err != nil { return nil, err } - log.Printf("[DEBUG] Retrieved policy for %s: %+v\n", updater.DescribeResource(), policy) + log.Print(spew.Sprintf("[DEBUG] Retrieved policy for %s: %#v\n", updater.DescribeResource(), policy)) return policy, nil } diff --git a/google/iam_organization.go b/google/iam_organization.go index c67d6555e..bb55c819e 100644 --- a/google/iam_organization.go +++ b/google/iam_organization.go @@ -43,7 +43,14 @@ func (u *OrganizationIamUpdater) GetResourceIamPolicy() (*cloudresourcemanager.P return nil, err } - p, err := u.Config.NewResourceManagerClient(userAgent).Organizations.GetIamPolicy("organizations/"+u.resourceId, &cloudresourcemanager.GetIamPolicyRequest{}).Do() + p, err := u.Config.NewResourceManagerClient(userAgent).Organizations.GetIamPolicy( + "organizations/"+u.resourceId, + &cloudresourcemanager.GetIamPolicyRequest{ + Options: &cloudresourcemanager.GetPolicyOptions{ + RequestedPolicyVersion: iamPolicyVersion, + }, + }, + ).Do() if err != nil { return nil, errwrap.Wrapf(fmt.Sprintf("Error retrieving IAM policy for %s: {{err}}", u.DescribeResource()), err) }