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

Add notificationPubsubTopic to BigQuery Data Transfer #3881

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions products/bigquerydatatransfer/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ objects:
about the format here:
https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format
NOTE: the granularity should be at least 8 hours, or less frequent.
- !ruby/object:Api::Type::String
name: 'notificationPubsubTopic'
description: |
Pub/Sub topic where notifications will be sent after transfer runs
associated with this transfer config finish.
- !ruby/object:Api::Type::Integer
name: 'dataRefreshWindowDays'
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ resource "google_bigquery_dataset" "my_dataset" {
location = "asia-northeast1"
}

resource "google_pubsub_topic" "my_topic" {
name = "my_topic"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be given a name with randomness like we do for the dataset? That'll make sure separate test runs don't conflict. Also starting it with tf-test is a good practice because we have some automation that cleans up resources in our test environment with that prefix.

}

resource "google_bigquery_data_transfer_config" "query_config" {
depends_on = [google_project_iam_member.permissions]

Expand All @@ -172,6 +176,7 @@ resource "google_bigquery_data_transfer_config" "query_config" {
data_source_id = "scheduled_query"
schedule = "%s sunday of quarter 00:00"
destination_dataset_id = google_bigquery_dataset.my_dataset.dataset_id
notification_pubsub_topic = google_pubsub_topic.my_topic.id
params = {
destination_table_name_template = "my_table"
write_disposition = "WRITE_APPEND"
Expand Down