Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore members with "deleted:" prefix in bigquery IAM member #8231

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/4388.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
bigquery: fixed an issue in `bigquery_dataset_iam_member` where deleted members were not handled correctly
```
8 changes: 8 additions & 0 deletions google/iam_bigquery_dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ func policyToAccess(policy *cloudresourcemanager.Policy) ([]map[string]interface
return nil, fmt.Errorf("BigQuery Dataset legacy role %s is not allowed when using google_bigquery_dataset_iam resources. Please use the full form: %s", binding.Role, fullRole)
}
for _, member := range binding.Members {
// Do not append any deleted members
if strings.HasPrefix(member, "deleted:") {
continue
}
access := map[string]interface{}{
"role": binding.Role,
}
Expand All @@ -190,6 +194,10 @@ func policyToAccess(policy *cloudresourcemanager.Policy) ([]map[string]interface
// Dataset access uses different member types to identify groups, domains, etc.
// these types are used as keys in the access JSON payload
func iamMemberToAccess(member string) (string, string, error) {
if strings.HasPrefix(member, "deleted:") {
return "", "", fmt.Errorf("BigQuery Dataset IAM member is deleted: %s", member)
}

pieces := strings.SplitN(member, ":", 2)
if len(pieces) > 1 {
switch pieces[0] {
Expand Down