@@ -49,3 +49,59 @@ resource "google_storage_bucket" "contenttest" {
49
49
force_destroy = true
50
50
}` , content , bucket )
51
51
}
52
+
53
+ func TestAccDataSourceStorageBucketObjectContent_Issue15717 (t * testing.T ) {
54
+
55
+ bucket := "tf-bucket-object-content-" + acctest .RandString (t , 10 )
56
+ content := "qwertyuioasdfghjk1234567!!@#$*"
57
+
58
+ config := fmt .Sprintf (`
59
+ %s
60
+
61
+ output "output" {
62
+ value = replace(data.google_storage_bucket_object_content.default.content, "q", "Q")
63
+ }` , testAccDataSourceStorageBucketObjectContent_Basic (content , bucket ))
64
+
65
+ acctest .VcrTest (t , resource.TestCase {
66
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
67
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
68
+ Steps : []resource.TestStep {
69
+ {
70
+ Config : config ,
71
+ Check : resource .ComposeTestCheckFunc (
72
+ resource .TestCheckResourceAttrSet ("data.google_storage_bucket_object_content.default" , "content" ),
73
+ resource .TestCheckResourceAttr ("data.google_storage_bucket_object_content.default" , "content" , content ),
74
+ ),
75
+ },
76
+ },
77
+ })
78
+ }
79
+
80
+ func TestAccDataSourceStorageBucketObjectContent_Issue15717BackwardCompatibility (t * testing.T ) {
81
+
82
+ bucket := "tf-bucket-object-content-" + acctest .RandString (t , 10 )
83
+ content := "qwertyuioasdfghjk1234567!!@#$*"
84
+
85
+ config := fmt .Sprintf (`
86
+ %s
87
+
88
+ data "google_storage_bucket_object_content" "new" {
89
+ bucket = google_storage_bucket.contenttest.name
90
+ content = "%s"
91
+ name = google_storage_bucket_object.object.name
92
+ }` , testAccDataSourceStorageBucketObjectContent_Basic (content , bucket ), content )
93
+
94
+ acctest .VcrTest (t , resource.TestCase {
95
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
96
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
97
+ Steps : []resource.TestStep {
98
+ {
99
+ Config : config ,
100
+ Check : resource .ComposeTestCheckFunc (
101
+ resource .TestCheckResourceAttrSet ("data.google_storage_bucket_object_content.new" , "content" ),
102
+ resource .TestCheckResourceAttr ("data.google_storage_bucket_object_content.new" , "content" , content ),
103
+ ),
104
+ },
105
+ },
106
+ })
107
+ }
0 commit comments