@@ -43,6 +43,147 @@ func TestAccStorageInsightsReportConfig_update(t *testing.T) {
43
43
})
44
44
}
45
45
46
+ func TestAccStorageInsightsReportConfig_parquet (t * testing.T ) {
47
+ t .Parallel ()
48
+
49
+ context := map [string ]interface {}{
50
+ "random_suffix" : acctest .RandString (t , 10 ),
51
+ }
52
+
53
+ acctest .VcrTest (t , resource.TestCase {
54
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
55
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
56
+ Steps : []resource.TestStep {
57
+ {
58
+ Config : testAccStorageInsightsReportConfig_parquet (context ),
59
+ },
60
+ {
61
+ ResourceName : "google_storage_insights_report_config.config" ,
62
+ ImportState : true ,
63
+ ImportStateVerify : true ,
64
+ ImportStateVerifyIgnore : []string {"location" },
65
+ },
66
+ {
67
+ Config : testAccStorageInsightsReportConfig_updateCsv (context ),
68
+ },
69
+ {
70
+ ResourceName : "google_storage_insights_report_config.config" ,
71
+ ImportState : true ,
72
+ ImportStateVerify : true ,
73
+ ImportStateVerifyIgnore : []string {"location" },
74
+ },
75
+ },
76
+ })
77
+ }
78
+
79
+ func testAccStorageInsightsReportConfig_parquet (context map [string ]interface {}) string {
80
+ return acctest .Nprintf (`
81
+ data "google_project" "project" {
82
+ }
83
+
84
+ resource "google_storage_insights_report_config" "config" {
85
+ display_name = "Test Report Config"
86
+ location = "us-central1"
87
+ frequency_options {
88
+ frequency = "WEEKLY"
89
+ start_date {
90
+ day = 15
91
+ month = 3
92
+ year = 2050
93
+ }
94
+ end_date {
95
+ day = 15
96
+ month = 4
97
+ year = 2050
98
+ }
99
+ }
100
+ parquet_options {}
101
+ object_metadata_report_options {
102
+ metadata_fields = ["bucket", "name", "project"]
103
+ storage_filters {
104
+ bucket = google_storage_bucket.report_bucket.name
105
+ }
106
+ storage_destination_options {
107
+ bucket = google_storage_bucket.report_bucket.name
108
+ destination_path = "test-insights-reports"
109
+ }
110
+ }
111
+ depends_on = [
112
+ google_storage_bucket_iam_member.admin,
113
+ ]
114
+ }
115
+
116
+ resource "google_storage_bucket" "report_bucket" {
117
+ name = "tf-test-my-bucket%{random_suffix}"
118
+ location = "us-central1"
119
+ force_destroy = true
120
+ uniform_bucket_level_access = true
121
+ }
122
+
123
+ resource "google_storage_bucket_iam_member" "admin" {
124
+ bucket = google_storage_bucket.report_bucket.name
125
+ role = "roles/storage.admin"
126
+ member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com"
127
+ }
128
+ ` , context )
129
+ }
130
+
131
+ func testAccStorageInsightsReportConfig_updateCsv (context map [string ]interface {}) string {
132
+ return acctest .Nprintf (`
133
+ data "google_project" "project" {
134
+ }
135
+
136
+ resource "google_storage_insights_report_config" "config" {
137
+ display_name = "Test Report Config"
138
+ location = "us-central1"
139
+ frequency_options {
140
+ frequency = "WEEKLY"
141
+ start_date {
142
+ day = 15
143
+ month = 3
144
+ year = 2050
145
+ }
146
+ end_date {
147
+ day = 15
148
+ month = 4
149
+ year = 2050
150
+ }
151
+ }
152
+ csv_options {
153
+ record_separator = "\n"
154
+ delimiter = ","
155
+ header_required = false
156
+ }
157
+ object_metadata_report_options {
158
+ metadata_fields = ["bucket", "name", "project"]
159
+ storage_filters {
160
+ bucket = google_storage_bucket.report_bucket.name
161
+ }
162
+ storage_destination_options {
163
+ bucket = google_storage_bucket.report_bucket.name
164
+ destination_path = "test-insights-reports"
165
+ }
166
+ }
167
+ depends_on = [
168
+ google_storage_bucket_iam_member.admin,
169
+ ]
170
+ }
171
+
172
+ resource "google_storage_bucket" "report_bucket" {
173
+ name = "tf-test-my-bucket%{random_suffix}"
174
+ location = "us-central1"
175
+ force_destroy = true
176
+ uniform_bucket_level_access = true
177
+ }
178
+
179
+ resource "google_storage_bucket_iam_member" "admin" {
180
+ bucket = google_storage_bucket.report_bucket.name
181
+ role = "roles/storage.admin"
182
+ member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com"
183
+ }
184
+ ` , context )
185
+ }
186
+
46
187
func testAccStorageInsightsReportConfig_full (context map [string ]interface {}) string {
47
188
return acctest .Nprintf (`
48
189
data "google_project" "project" {
@@ -120,11 +261,7 @@ resource "google_storage_insights_report_config" "config" {
120
261
year = 2040
121
262
}
122
263
}
123
- csv_options {
124
- record_separator = "\r\n"
125
- delimiter = "."
126
- header_required = true
127
- }
264
+ parquet_options {}
128
265
object_metadata_report_options {
129
266
metadata_fields = ["bucket", "name", "project"]
130
267
storage_filters {
0 commit comments