Skip to content

Commit

Permalink
Add pre-read custom code to BQ dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
obada-ab committed Dec 16, 2024
1 parent 3f1c07e commit 11012e3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mmv1/products/bigquery/Dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ docs:
The API does accept both formats but it will always return the legacy format which results in Terraform
showing permanent diff on each plan and apply operation.
base_url: 'projects/{{project}}/datasets'
cai_base_url: 'projects/{{project}}/datasets/{{dataset_id}}'
id_format: 'projects/{{project}}/datasets/{{dataset_id}}'
self_link: 'projects/{{project}}/datasets/{{dataset_id}}?accessPolicyVersion=3'
self_link: 'projects/{{project}}/datasets/{{dataset_id}}'
has_self_link: true
create_url: 'projects/{{project}}/datasets?accessPolicyVersion=3'
update_url: 'projects/{{project}}/datasets/{{dataset_id}}?accessPolicyVersion=3'
delete_url: 'projects/{{project}}/datasets/{{dataset_id}}?deleteContents={{delete_contents_on_destroy}}'
import_format:
- 'projects/{{project}}/datasets/{{dataset_id}}'
Expand All @@ -40,6 +39,7 @@ timeouts:
delete_minutes: 20
custom_code:
constants: 'templates/terraform/constants/bigquery_dataset.go.tmpl'
pre_read: 'templates/terraform/pre_read/bigquery_dataset.go.tmpl'
exclude_sweeper: true
examples:
- name: 'bigquery_dataset_basic'
Expand Down
13 changes: 13 additions & 0 deletions mmv1/templates/terraform/pre_read/bigquery_dataset.go.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{/*
The license inside this block applies to this file
Copyright 2024 Google Inc.
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.
*/ -}}
url = url + "?accessPolicyVersion=3";

0 comments on commit 11012e3

Please sign in to comment.