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

Fixes roleset bindings for BigQuery datasets #130

Merged
merged 7 commits into from
Dec 23, 2021

Conversation

austingebauer
Copy link
Contributor

@austingebauer austingebauer commented Dec 17, 2021

Overview

This PR fixes roleset bindings scoped to BigQuery datasets. There was a typo in the switch case when detecting the key type of the resource. You can see that the correct key is projects/datasets on resource_overrides.go#L12.

Fixes #96
Fixes hashicorp/vault#10923

Testing

I manually tested that the service account principal created for the Vault roleset has the "BigQuery Data Viewer" scoped to the specified BigQuery dataset.

The following bindings were used:

vault write gcp/roleset/bigquery-binding \
    project="austin-gebauer" \
    secret_type="service_account_key"  \
    bindings=-<<EOF
    resource "//bigquery.googleapis.com/projects/austin-gebauer/datasets/test_vault_bindings_dataset" {
     	roles = [
            "roles/bigquery.dataViewer",
        ]
    }
EOF

calvn
calvn previously approved these changes Dec 17, 2021
jasonodonnell
jasonodonnell previously approved these changes Dec 17, 2021
@fairclothjm
Copy link
Contributor

Does this also need to be changed to "datasets"?

@calvn
Copy link
Contributor

calvn commented Dec 17, 2021

@fairclothjm I think that's fine/intended since it's for mapping datasets->dataset which is specific to gcputil.RelativeResourceName?

calvn
calvn previously approved these changes Dec 17, 2021
Copy link
Contributor

@calvn calvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment around the test. Nice find!

@austingebauer austingebauer dismissed stale reviews from calvn and jasonodonnell via 485c761 December 18, 2021 01:19
@austingebauer
Copy link
Contributor Author

Not sure why pushing commits keeps dismissing reviews..

@austingebauer
Copy link
Contributor Author

@fairclothjm - You're right that it should be projects/datasets there. Confirmed with debugger that RelativeResourceName.TypeKey matches the RestResource.TypeKey when creating a roleset. This is true for both IamResource and DatasetResource. Updated in 485c761.

@austingebauer austingebauer requested a review from calvn December 21, 2021 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants