@@ -150,6 +150,27 @@ func TestAccGoogleStorageObject_withContentCharacteristics(t *testing.T) {
150
150
})
151
151
}
152
152
153
+ func TestAccGoogleStorageObject_dynamicContent (t * testing.T ) {
154
+ t .Parallel ()
155
+
156
+ resource .Test (t , resource.TestCase {
157
+ PreCheck : func () { testAccPreCheck (t ) },
158
+ Providers : testAccProviders ,
159
+ CheckDestroy : testAccGoogleStorageObjectDestroy ,
160
+ Steps : []resource.TestStep {
161
+ resource.TestStep {
162
+ Config : testGoogleStorageBucketsObjectDynamicContent (testBucketName ()),
163
+ Check : resource .ComposeTestCheckFunc (
164
+ resource .TestCheckResourceAttr (
165
+ "google_storage_bucket_object.object" , "content_type" , "text/plain; charset=utf-8" ),
166
+ resource .TestCheckResourceAttr (
167
+ "google_storage_bucket_object.object" , "storage_class" , "STANDARD" ),
168
+ ),
169
+ },
170
+ },
171
+ })
172
+ }
173
+
153
174
func TestAccGoogleStorageObject_cacheControl (t * testing.T ) {
154
175
t .Parallel ()
155
176
@@ -267,6 +288,20 @@ resource "google_storage_bucket_object" "object" {
267
288
` , bucketName , objectName , content )
268
289
}
269
290
291
+ func testGoogleStorageBucketsObjectDynamicContent (bucketName string ) string {
292
+ return fmt .Sprintf (`
293
+ resource "google_storage_bucket" "bucket" {
294
+ name = "%s"
295
+ }
296
+
297
+ resource "google_storage_bucket_object" "object" {
298
+ name = "%s"
299
+ bucket = "${google_storage_bucket.bucket.name}"
300
+ content = "${google_storage_bucket.bucket.project}"
301
+ }
302
+ ` , bucketName , objectName )
303
+ }
304
+
270
305
func testGoogleStorageBucketsObjectBasic (bucketName , sourceFilename string ) string {
271
306
return fmt .Sprintf (`
272
307
resource "google_storage_bucket" "bucket" {
0 commit comments