From 90d16261df95dbfe45c4649e26cedc996c8e8299 Mon Sep 17 00:00:00 2001 From: 14kw <14codemail@gmail.com> Date: Tue, 18 Aug 2020 10:40:38 +0000 Subject: [PATCH 1/2] Add notificationPubsubTopic to BigQuery Data Transfer --- products/bigquerydatatransfer/api.yaml | 5 +++++ .../tests/resource_bigquery_data_transfer_config_test.go | 5 +++++ 2 files changed, 10 insertions(+) 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..c4b8ec96971d 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 = "my_topic" +} + resource "google_bigquery_data_transfer_config" "query_config" { depends_on = [google_project_iam_member.permissions] @@ -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" From f3b0aa8a478563affcbba6233fcdbc41503d337a Mon Sep 17 00:00:00 2001 From: 14kw <14codemail@gmail.com> Date: Fri, 21 Aug 2020 03:08:51 +0000 Subject: [PATCH 2/2] Fix test resource names suffix to be random --- .../tests/resource_bigquery_data_transfer_config_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 c4b8ec96971d..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 @@ -165,7 +165,7 @@ resource "google_bigquery_dataset" "my_dataset" { } resource "google_pubsub_topic" "my_topic" { - name = "my_topic" + name = "tf-test-my-topic-%s" } resource "google_bigquery_data_transfer_config" "query_config" { @@ -183,7 +183,7 @@ resource "google_bigquery_data_transfer_config" "query_config" { 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 {