Add bigquery authorized resources (#1480)

* add bq authorized views, datasets, and routines

* fmt

* add backwards compatible test case

* minor docs clarification

* add docs table and fix lint tests

* fix docs

* fix tests

* fix more lint issues

* fix lint issue

* fix tests

* fix lint

* fix tests

* alphabetical order

* add detailed example to docs and corresponding test

* clarify docs for variables

* remove unnecessary depends_on
This commit is contained in:
Thinh Ha
2023-06-30 17:44:57 +01:00
committed by GitHub
parent ac9417b82d
commit 10e15356ea
7 changed files with 321 additions and 37 deletions

View File

@@ -0,0 +1,42 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
values:
module.bigquery-dataset-private.google_bigquery_dataset.default:
dataset_id: private_dataset
project: private_project
module.bigquery-dataset-private.google_bigquery_dataset_access.authorized_datasets["auth_dataset_project_auth_dataset"]:
dataset:
- dataset:
- dataset_id: auth_dataset
project_id: auth_dataset_project
target_types: ["VIEWS"]
module.bigquery-dataset-private.google_bigquery_dataset_access.authorized_routines["auth_routine_project_auth_routine_dataset_auth_routine"]:
routine:
- dataset_id: auth_routine_dataset
project_id: auth_routine_project
routine_id: auth_routine
module.bigquery-dataset-private.google_bigquery_dataset_access.authorized_views["auth_view_project_auth_view_dataset_auth_view"]:
view:
- dataset_id: auth_view_dataset
project_id: auth_view_project
table_id: auth_view
counts:
google_bigquery_dataset: 4
google_bigquery_dataset_access: 3
google_bigquery_routine: 1
google_bigquery_table: 1
modules: 4
resources: 9

View File

@@ -0,0 +1,36 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
values:
module.bigquery-dataset.google_bigquery_dataset.default:
dataset_id: my-dataset
project: my-project
module.bigquery-dataset.google_bigquery_dataset_access.authorized_views["view_project_view_dataset_view_id_1"]:
view:
- dataset_id: view_dataset
project_id: view_project
table_id: view_id_1
module.bigquery-dataset.google_bigquery_dataset_access.authorized_views["view_project_view_dataset_view_id_2"]:
view:
- dataset_id: view_dataset
project_id: view_project
table_id: view_id_2
module.bigquery-dataset.google_bigquery_dataset_access.authorized_views["view_project_view_dataset_view_id_3"]:
view:
- dataset_id: view_dataset
project_id: view_project
table_id: view_id_3
counts:
google_bigquery_dataset: 1
google_bigquery_dataset_access: 3

View File

@@ -33,7 +33,7 @@ values:
project: my-project
role: OWNER
user_by_email: ludo@ludomagno.net
module.bigquery-dataset.google_bigquery_dataset_access.views["view_1"]:
module.bigquery-dataset.google_bigquery_dataset_access.authorized_views["my-project_my-dataset_my-table"]:
dataset_id: my-dataset
project: my-project
view: