From cc4c792fe57049a63eec8e633b0c21387d1b8849 Mon Sep 17 00:00:00 2001 From: Takayuki Ishikawa <14codemail@gmail.com> Date: Sat, 22 Aug 2020 00:42:51 +0900 Subject: [PATCH] Add `notificationPubsubTopic` to BigQuery Data Transfer (#3881) * Add notificationPubsubTopic to BigQuery Data Transfer * Fix test resource names suffix to be random --- products/bigquerydatatransfer/api.yaml | 5 +++++ .../tests/resource_bigquery_data_transfer_config_test.go | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/products/bigquerydatatransfer/api.yaml b/products/bigquerydatatransfer/api.yaml index e9c08724dc03..1f0d9e9a91f9 100644 --- a/products/bigquerydatatransfer/api.yaml +++ b/products/bigquerydatatransfer/api.yaml @@ -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: | diff --git a/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go b/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go index 273d1ce25be3..f9918077a158 100644 --- a/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go +++ b/third_party/terraform/tests/resource_bigquery_data_transfer_config_test.go @@ -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] @@ -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 {