forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BigQuery Authorized datasets (GoogleCloudPlatform#5700)
* Add authorized views to bigquery_dataset * Add authorized view to dataset_access * Fix test file * Add required to nested dataset field
- Loading branch information
Showing
7 changed files
with
272 additions
and
0 deletions.
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
18 changes: 18 additions & 0 deletions
18
mmv1/templates/terraform/examples/bigquery_dataset_access_authorized_dataset.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,18 @@ | ||
resource "google_bigquery_dataset_access" "<%= ctx[:primary_resource_id] %>" { | ||
dataset_id = google_bigquery_dataset.private.dataset_id | ||
dataset { | ||
dataset{ | ||
project_id = google_bigquery_dataset.public.project | ||
dataset_id = google_bigquery_dataset.public.dataset_id | ||
} | ||
target_types = ["VIEWS"] | ||
} | ||
} | ||
|
||
resource "google_bigquery_dataset" "private" { | ||
dataset_id = "<%= ctx[:vars]['private'] %>" | ||
} | ||
|
||
resource "google_bigquery_dataset" "public" { | ||
dataset_id = "<%= ctx[:vars]['public'] %>" | ||
} |
57 changes: 57 additions & 0 deletions
57
mmv1/templates/terraform/examples/bigquery_dataset_authorized_dataset.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,57 @@ | ||
resource "google_bigquery_dataset" "public" { | ||
dataset_id = "<%= ctx[:vars]['public'] %>" | ||
friendly_name = "test" | ||
description = "This dataset is public" | ||
location = "EU" | ||
default_table_expiration_ms = 3600000 | ||
|
||
labels = { | ||
env = "default" | ||
} | ||
|
||
access { | ||
role = "OWNER" | ||
user_by_email = google_service_account.bqowner.email | ||
} | ||
|
||
access { | ||
role = "READER" | ||
domain = "hashicorp.com" | ||
} | ||
} | ||
|
||
resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { | ||
dataset_id = "<%= ctx[:vars]['private'] %>" | ||
friendly_name = "test" | ||
description = "This dataset is private" | ||
location = "EU" | ||
default_table_expiration_ms = 3600000 | ||
|
||
labels = { | ||
env = "default" | ||
} | ||
|
||
access { | ||
role = "OWNER" | ||
user_by_email = google_service_account.bqowner.email | ||
} | ||
|
||
access { | ||
role = "READER" | ||
domain = "hashicorp.com" | ||
} | ||
|
||
access { | ||
dataset { | ||
dataset { | ||
project_id = google_bigquery_dataset.public.project | ||
dataset_id = google_bigquery_dataset.public.dataset_id | ||
} | ||
target_types = ["VIEWS"] | ||
} | ||
} | ||
} | ||
|
||
resource "google_service_account" "bqowner" { | ||
account_id = "<%= ctx[:vars]['account_name'] %>" | ||
} |
57 changes: 57 additions & 0 deletions
57
mmv1/templates/terraform/examples/bigquery_dataset_authorized_view.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,57 @@ | ||
resource "google_bigquery_dataset" "public" { | ||
dataset_id = "<%= ctx[:vars]['grant_dataset_id'] %>" | ||
friendly_name = "test" | ||
description = "This dataset is public" | ||
location = "EU" | ||
default_table_expiration_ms = 3600000 | ||
|
||
labels = { | ||
env = "default" | ||
} | ||
|
||
access { | ||
role = "OWNER" | ||
user_by_email = google_service_account.bqowner.email | ||
} | ||
|
||
access { | ||
role = "READER" | ||
domain = "hashicorp.com" | ||
} | ||
} | ||
|
||
resource "google_bigquery_dataset" "<%= ctx[:primary_resource_id] %>" { | ||
dataset_id = "<%= ctx[:vars]['dataset_id'] %>" | ||
friendly_name = "test" | ||
description = "This dataset is private" | ||
location = "EU" | ||
default_table_expiration_ms = 3600000 | ||
|
||
labels = { | ||
env = "default" | ||
} | ||
|
||
access { | ||
role = "OWNER" | ||
user_by_email = google_service_account.bqowner.email | ||
} | ||
|
||
access { | ||
role = "READER" | ||
domain = "hashicorp.com" | ||
} | ||
|
||
access { | ||
dataset { | ||
dataset { | ||
project_id = google_bigquery_dataset.to_authorize.project | ||
dataset_id = google_bigquery_dataset.to_authorize.dataset_id | ||
} | ||
target_types = ["VIEWS"] | ||
} | ||
} | ||
} | ||
|
||
resource "google_service_account" "bqowner" { | ||
account_id = "<%= ctx[:vars]['account_name'] %>" | ||
} |
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