@@ -443,7 +443,10 @@ func TestAccBigQueryBigLakeManagedTable(t *testing.T) {
443443 acctest .VcrTest (t , resource.TestCase {
444444 PreCheck : func () { acctest .AccTestPreCheck (t ) },
445445 ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
446- CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
446+ ExternalProviders : map [string ]resource.ExternalProvider {
447+ "time" : {},
448+ },
449+ CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
447450 Steps : []resource.TestStep {
448451 {
449452 Config : testAccBigLakeManagedTable (bucketName , connectionID , datasetID , tableID , TEST_SIMPLE_CSV_SCHEMA ),
@@ -472,10 +475,16 @@ func testAccBigLakeManagedTable(bucketName, connectionID, datasetID, tableID, sc
472475 location = "US"
473476 cloud_resource {}
474477 }
478+ // wait for SA creation
479+ resource "time_sleep" "wait_120_seconds" {
480+ create_duration = "120s"
481+ depends_on = [google_bigquery_connection.test]
482+ }
475483 resource "google_project_iam_member" "test" {
476484 role = "roles/storage.objectAdmin"
477485 project = data.google_project.project.id
478486 member = "serviceAccount:${google_bigquery_connection.test.cloud_resource[0].service_account_id}"
487+ depends_on = [time_sleep.wait_120_seconds]
479488 }
480489 resource "google_bigquery_dataset" "test" {
481490 dataset_id = "%s"
@@ -987,7 +996,10 @@ func TestAccBigQueryExternalDataTable_queryAcceleration(t *testing.T) {
987996 acctest .VcrTest (t , resource.TestCase {
988997 PreCheck : func () { acctest .AccTestPreCheck (t ) },
989998 ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
990- CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
999+ ExternalProviders : map [string ]resource.ExternalProvider {
1000+ "time" : {},
1001+ },
1002+ CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
9911003 Steps : []resource.TestStep {
9921004 {
9931005 Config : testAccBigQueryTableFromGCSParquetWithQueryAcceleration (connectionID , datasetID , tableID , bucketName , objectName , metadataCacheMode , maxStaleness ),
@@ -1043,7 +1055,10 @@ func TestAccBigQueryExternalDataTable_connectionIdDiff_UseNameReference(t *testi
10431055 acctest .VcrTest (t , resource.TestCase {
10441056 PreCheck : func () { acctest .AccTestPreCheck (t ) },
10451057 ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
1046- CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
1058+ ExternalProviders : map [string ]resource.ExternalProvider {
1059+ "time" : {},
1060+ },
1061+ CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
10471062 Steps : []resource.TestStep {
10481063 {
10491064 Config : testAccBigQueryTableExternalDataConfigurationConnectionID (location , connectionID , datasetID , tableID , bucketName , objectName , connection_id_reference ),
@@ -1068,7 +1083,10 @@ func TestAccBigQueryExternalDataTable_connectionIdDiff_UseIdReference(t *testing
10681083 acctest .VcrTest (t , resource.TestCase {
10691084 PreCheck : func () { acctest .AccTestPreCheck (t ) },
10701085 ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
1071- CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
1086+ ExternalProviders : map [string ]resource.ExternalProvider {
1087+ "time" : {},
1088+ },
1089+ CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
10721090 Steps : []resource.TestStep {
10731091 {
10741092 Config : testAccBigQueryTableExternalDataConfigurationConnectionID (location , connectionID , datasetID , tableID , bucketName , objectName , connection_id_reference ),
@@ -1093,7 +1111,10 @@ func TestAccBigQueryExternalDataTable_connectionIdDiff_UseIdReference_UsCentral1
10931111 acctest .VcrTest (t , resource.TestCase {
10941112 PreCheck : func () { acctest .AccTestPreCheck (t ) },
10951113 ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
1096- CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
1114+ ExternalProviders : map [string ]resource.ExternalProvider {
1115+ "time" : {},
1116+ },
1117+ CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
10971118 Steps : []resource.TestStep {
10981119 {
10991120 Config : testAccBigQueryTableExternalDataConfigurationConnectionID (location , connectionID , datasetID , tableID , bucketName , objectName , connection_id_reference ),
@@ -1118,7 +1139,10 @@ func TestAccBigQueryExternalDataTable_connectionIdDiff_UseIdReference_UsEast1(t
11181139 acctest .VcrTest (t , resource.TestCase {
11191140 PreCheck : func () { acctest .AccTestPreCheck (t ) },
11201141 ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
1121- CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
1142+ ExternalProviders : map [string ]resource.ExternalProvider {
1143+ "time" : {},
1144+ },
1145+ CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
11221146 Steps : []resource.TestStep {
11231147 {
11241148 Config : testAccBigQueryTableExternalDataConfigurationConnectionID (location , connectionID , datasetID , tableID , bucketName , objectName , connection_id_reference ),
@@ -1143,7 +1167,10 @@ func TestAccBigQueryExternalDataTable_connectionIdDiff_UseIdReference_EuropeWest
11431167 acctest .VcrTest (t , resource.TestCase {
11441168 PreCheck : func () { acctest .AccTestPreCheck (t ) },
11451169 ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
1146- CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
1170+ ExternalProviders : map [string ]resource.ExternalProvider {
1171+ "time" : {},
1172+ },
1173+ CheckDestroy : testAccCheckBigQueryTableDestroyProducer (t ),
11471174 Steps : []resource.TestStep {
11481175 {
11491176 Config : testAccBigQueryTableExternalDataConfigurationConnectionID (location , connectionID , datasetID , tableID , bucketName , objectName , connection_id_reference ),
@@ -3154,6 +3181,11 @@ resource "google_bigquery_connection" "test" {
31543181 location = "US"
31553182 cloud_resource {}
31563183}
3184+ // wait for SA creation
3185+ resource "time_sleep" "wait_120_seconds" {
3186+ create_duration = "120s"
3187+ depends_on = [google_bigquery_connection.test]
3188+ }
31573189
31583190locals {
31593191 connection_id_split = split("/", google_bigquery_connection.test.name)
@@ -3166,6 +3198,7 @@ locals {
31663198 role = "roles/storage.objectViewer"
31673199 project = data.google_project.project.id
31683200 member = "serviceAccount:${google_bigquery_connection.test.cloud_resource[0].service_account_id}"
3201+ depends_on = [time_sleep.wait_120_seconds]
31693202 }
31703203
31713204resource "google_bigquery_dataset" "test" {
@@ -3430,13 +3463,19 @@ resource "google_bigquery_connection" "test" {
34303463 location = "%s"
34313464 cloud_resource {}
34323465}
3466+ // wait for SA creation
3467+ resource "time_sleep" "wait_120_seconds" {
3468+ create_duration = "120s"
3469+ depends_on = [google_bigquery_connection.test]
3470+ }
34333471
34343472data "google_project" "project" {}
34353473
34363474resource "google_project_iam_member" "test" {
34373475 role = "roles/storage.objectViewer"
34383476 project = data.google_project.project.id
34393477 member = "serviceAccount:${google_bigquery_connection.test.cloud_resource[0].service_account_id}"
3478+ depends_on = [time_sleep.wait_120_seconds]
34403479}
34413480
34423481resource "google_bigquery_dataset" "test" {
0 commit comments