@@ -15,13 +15,13 @@ func TestAccSecurityCenterV2ProjectBigQueryExportConfig_basic(t *testing.T) {
15
15
t .Parallel ()
16
16
17
17
randomSuffix := acctest .RandString (t , 10 )
18
- dataset_id := "tf_test_" + randomSuffix
18
+ datasetID := "tf_test_" + randomSuffix
19
19
orgID := envvar .GetTestOrgFromEnv (t )
20
20
21
21
context := map [string ]interface {}{
22
22
"org_id" : orgID ,
23
23
"random_suffix" : randomSuffix ,
24
- "dataset_id" : dataset_id ,
24
+ "dataset_id" : datasetID ,
25
25
"big_query_export_id" : "tf-test-export-" + randomSuffix ,
26
26
"name" : fmt .Sprintf ("projects/%s/locations/global/bigQueryExports/%s" ,
27
27
envvar .GetTestProjectFromEnv (), "tf-test-export-" + randomSuffix ),
@@ -68,6 +68,7 @@ resource "google_bigquery_dataset" "default" {
68
68
location = "US"
69
69
default_table_expiration_ms = 3600000
70
70
default_partition_expiration_ms = null
71
+ delete_contents_on_destroy = true
71
72
72
73
labels = {
73
74
env = "default"
@@ -80,7 +81,10 @@ resource "google_bigquery_dataset" "default" {
80
81
81
82
resource "time_sleep" "wait_1_minute" {
82
83
depends_on = [google_bigquery_dataset.default]
83
- create_duration = "3m"
84
+ create_duration = "6m"
85
+ # need to wait for destruction due to
86
+ # 'still in use' error from api
87
+ destroy_duration = "1m"
84
88
}
85
89
86
90
resource "google_scc_v2_project_scc_big_query_export" "default" {
@@ -94,6 +98,11 @@ resource "google_scc_v2_project_scc_big_query_export" "default" {
94
98
depends_on = [time_sleep.wait_1_minute]
95
99
}
96
100
101
+ resource "time_sleep" "wait_for_cleanup" {
102
+ create_duration = "6m"
103
+ depends_on = [google_scc_v2_project_scc_big_query_export.default]
104
+ }
105
+
97
106
` , context )
98
107
}
99
108
@@ -107,6 +116,7 @@ resource "google_bigquery_dataset" "default" {
107
116
location = "US"
108
117
default_table_expiration_ms = 3600000
109
118
default_partition_expiration_ms = null
119
+ delete_contents_on_destroy = true
110
120
111
121
labels = {
112
122
env = "default"
@@ -117,6 +127,14 @@ resource "google_bigquery_dataset" "default" {
117
127
}
118
128
}
119
129
130
+ resource "time_sleep" "wait_1_minute" {
131
+ depends_on = [google_bigquery_dataset.default]
132
+ create_duration = "6m"
133
+ # need to wait for destruction due to
134
+ # 'still in use' error from api
135
+ destroy_duration = "1m"
136
+ }
137
+
120
138
resource "google_scc_v2_project_scc_big_query_export" "default" {
121
139
big_query_export_id = "%{big_query_export_id}"
122
140
project = "%{project}"
@@ -125,6 +143,13 @@ resource "google_scc_v2_project_scc_big_query_export" "default" {
125
143
description = "SCC Findings Big Query Export Update"
126
144
filter = "state=\"ACTIVE\" AND NOT mute=\"MUTED\""
127
145
146
+ depends_on = [time_sleep.wait_1_minute]
147
+
148
+ }
149
+
150
+ resource "time_sleep" "wait_for_cleanup" {
151
+ create_duration = "6m"
152
+ depends_on = [google_scc_v2_project_scc_big_query_export.default]
128
153
}
129
154
130
155
` , context )
0 commit comments