-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support BigQuery authorized routines #6680
Merged
melinath
merged 11 commits into
GoogleCloudPlatform:main
from
Tei1988:add-bq-authorized-routine
Nov 8, 2022
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eb62c88
BigQuery: Added support for authorized routine
Tei1988 b365c86
BigQuery: Added examples for authorized routine
Tei1988 15892ac
Update mmv1/products/bigquery/terraform.yaml
Tei1988 cb66e9f
Update mmv1/templates/terraform/examples/bigquery_dataset_authorized_…
Tei1988 8fc5fa6
add legacy iam access to test case
Tei1988 37db76f
remove legacy roles
Tei1988 bbbca23
correct variable names and values
Tei1988 07a79e8
replace - to _
Tei1988 e7bd83c
[wip]added hand written test
Tei1988 91656ad
fix corrupted test
Tei1988 6d032b8
Update mmv1/third_party/terraform/tests/resource_bigquery_dataset_acc…
Tei1988 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_routine.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
resource "google_bigquery_dataset" "public" { | ||
dataset_id = "<%= ctx[:vars]['public_dataset'] %>" | ||
description = "This dataset is public" | ||
} | ||
|
||
resource "google_bigquery_routine" "public" { | ||
dataset_id = google_bigquery_dataset.public.dataset_id | ||
routine_id = "<%= ctx[:vars]['public_routine'] %>" | ||
routine_type = "TABLE_VALUED_FUNCTION" | ||
language = "SQL" | ||
definition_body = <<-EOS | ||
SELECT 1 + value AS value | ||
EOS | ||
arguments { | ||
name = "value" | ||
argument_kind = "FIXED_TYPE" | ||
data_type = jsonencode({ "typeKind" = "INT64" }) | ||
} | ||
return_table_type = jsonencode({ "columns" = [ | ||
{ "name" = "value", "type" = { "typeKind" = "INT64" } }, | ||
] }) | ||
} | ||
|
||
resource "google_bigquery_dataset" "private" { | ||
dataset_id = "<%= ctx[:vars]['private_dataset'] %>" | ||
description = "This dataset is private" | ||
} | ||
|
||
resource "google_bigquery_dataset_access" "authorized_routine" { | ||
dataset_id = google_bigquery_dataset.private.dataset_id | ||
routine { | ||
project_id = google_bigquery_routine.public.project | ||
dataset_id = google_bigquery_routine.public.dataset_id | ||
routine_id = google_bigquery_routine.public.routine_id | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
mmv1/templates/terraform/examples/bigquery_dataset_authorized_routine.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
resource "google_bigquery_dataset" "public" { | ||
dataset_id = "<%= ctx[:vars]['public_dataset'] %>" | ||
description = "This dataset is public" | ||
} | ||
|
||
resource "google_bigquery_routine" "public" { | ||
dataset_id = google_bigquery_dataset.public.dataset_id | ||
routine_id = "<%= ctx[:vars]['public_routine'] %>" | ||
routine_type = "TABLE_VALUED_FUNCTION" | ||
language = "SQL" | ||
definition_body = <<-EOS | ||
SELECT 1 + value AS value | ||
EOS | ||
arguments { | ||
name = "value" | ||
argument_kind = "FIXED_TYPE" | ||
data_type = jsonencode({ "typeKind" = "INT64" }) | ||
} | ||
return_table_type = jsonencode({ "columns" = [ | ||
{ "name" = "value", "type" = { "typeKind" = "INT64" } }, | ||
] }) | ||
} | ||
|
||
resource "google_bigquery_dataset" "private" { | ||
dataset_id = "<%= ctx[:vars]['private_dataset'] %>" | ||
description = "This dataset is private" | ||
access { | ||
role = "OWNER" | ||
user_by_email = "<%= ctx[:test_env_vars]['service_account'] %>" | ||
} | ||
access { | ||
routine { | ||
project_id = google_bigquery_routine.public.project | ||
dataset_id = google_bigquery_routine.public.dataset_id | ||
routine_id = google_bigquery_routine.public.routine_id | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like these can't run in VCR based on the surrounding tests.