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