Skip to content

Commit

Permalink
Send E-tag to signal empty policy
Browse files Browse the repository at this point in the history
  • Loading branch information
René Kroon committed Mar 29, 2018
1 parent 1d67188 commit dad108b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions google/iam_storage_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ func (u *StorageBucketIamUpdater) SetResourceIamPolicy(policy *cloudresourcemana
return errwrap.Wrapf(fmt.Sprintf("Invalid IAM policy for %s: {{err}}", u.DescribeResource()), err)
}

ppolicy, err := u.Config.clientStorage.Buckets.GetIamPolicy(u.bucket).Do()
if err != nil {
return errwrap.Wrapf(fmt.Sprintf("Error setting IAM policy for %s: {{err}}", u.DescribeResource()), err)
}
storagePolicy.Etag = ppolicy.Etag
_, err = u.Config.clientStorage.Buckets.SetIamPolicy(u.bucket, storagePolicy).Do()


if err != nil {
return errwrap.Wrapf(fmt.Sprintf("Error setting IAM policy for %s: {{err}}", u.DescribeResource()), err)
}
Expand Down

0 comments on commit dad108b

Please sign in to comment.