From 26c97045d5a160e688beaee1cf6d9e0a6acf19b1 Mon Sep 17 00:00:00 2001 From: wj-chen Date: Fri, 26 Apr 2024 08:43:24 -0700 Subject: [PATCH] Fix the failing tests TestAccBigQueryJob_bigqueryJobCopy* (#10520) --- .../terraform/examples/bigquery_job_copy.tf.erb | 8 ++++++-- .../examples/bigquery_job_copy_table_reference.tf.erb | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mmv1/templates/terraform/examples/bigquery_job_copy.tf.erb b/mmv1/templates/terraform/examples/bigquery_job_copy.tf.erb index 1790003b1166..8025df9b886b 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_copy.tf.erb +++ b/mmv1/templates/terraform/examples/bigquery_job_copy.tf.erb @@ -1,6 +1,10 @@ +locals { + count = 2 +} + resource "google_bigquery_table" "source" { deletion_protection = false - count = length(google_bigquery_dataset.source) + count = local.count dataset_id = google_bigquery_dataset.source[count.index].dataset_id table_id = "<%= ctx[:vars]['job_id'] %>_${count.index}_table" @@ -27,7 +31,7 @@ EOF } resource "google_bigquery_dataset" "source" { - count = 2 + count = local.count dataset_id = "<%= ctx[:vars]['job_id'] %>_${count.index}_dataset" friendly_name = "test" diff --git a/mmv1/templates/terraform/examples/bigquery_job_copy_table_reference.tf.erb b/mmv1/templates/terraform/examples/bigquery_job_copy_table_reference.tf.erb index 903e5b398d27..6112d5dee125 100644 --- a/mmv1/templates/terraform/examples/bigquery_job_copy_table_reference.tf.erb +++ b/mmv1/templates/terraform/examples/bigquery_job_copy_table_reference.tf.erb @@ -1,6 +1,10 @@ +locals { + count = 2 +} + resource "google_bigquery_table" "source" { deletion_protection = false - count = length(google_bigquery_dataset.source) + count = local.count dataset_id = google_bigquery_dataset.source[count.index].dataset_id table_id = "<%= ctx[:vars]['job_id'] %>_${count.index}_table" @@ -24,10 +28,12 @@ resource "google_bigquery_table" "source" { } ] EOF + + depends_on = [google_bigquery_dataset.source] } resource "google_bigquery_dataset" "source" { - count = 2 + count = local.count dataset_id = "<%= ctx[:vars]['job_id'] %>_${count.index}_dataset" friendly_name = "test"