Skip to content

Commit

Permalink
Add notificationPubsubTopic to BigQuery Data Transfer (#3881)
Browse files Browse the repository at this point in the history
* Add notificationPubsubTopic to BigQuery Data Transfer

* Fix test resource names suffix to be random
  • Loading branch information
14kw authored Aug 21, 2020
1 parent 3b3d00c commit cc4c792
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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 = "tf-test-my-topic-%s"
}
resource "google_bigquery_data_transfer_config" "query_config" {
depends_on = [google_project_iam_member.permissions]
Expand All @@ -172,13 +176,14 @@ 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"
query = "SELECT name FROM tabl WHERE x = '%s'"
}
}
`, random_suffix, random_suffix, schedule, letter)
`, random_suffix, random_suffix, random_suffix, schedule, letter)
}

func testAccBigqueryDataTransferConfig_scheduledQuery_service_account(random_suffix string) string {
Expand Down

0 comments on commit cc4c792

Please sign in to comment.