@@ -96,9 +96,10 @@ func TestAccCloudfunctions2functionIamPolicyGenerated(t *testing.T) {
9696
9797func testAccCloudfunctions2functionIamMember_basicGenerated (context map [string ]interface {}) string {
9898 return Nprintf (`
99+ # [START functions_v2_basic]
99100resource "google_storage_bucket" "bucket" {
100101 provider = google-beta
101- name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}"
102+ name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}" # Every bucket name must be globally unique
102103 location = "US"
103104 uniform_bucket_level_access = true
104105}
@@ -107,7 +108,7 @@ resource "google_storage_bucket_object" "object" {
107108 provider = google-beta
108109 name = "function-source.zip"
109110 bucket = google_storage_bucket.bucket.name
110- source = "%{zip_path}"
111+ source = "%{zip_path}" # Add path to the zipped function source code
111112}
112113
113114resource "google_cloudfunctions2_function" "terraform-test2" {
@@ -118,7 +119,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
118119
119120 build_config {
120121 runtime = "nodejs16"
121- entry_point = "helloHttp"
122+ entry_point = "helloHttp" # Set the entry point
122123 source {
123124 storage_source {
124125 bucket = google_storage_bucket.bucket.name
@@ -133,6 +134,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
133134 timeout_seconds = 60
134135 }
135136}
137+ # [END functions_v2_basic]
136138
137139resource "google_cloudfunctions2_function_iam_member" "foo" {
138140 provider = google-beta
@@ -146,9 +148,10 @@ resource "google_cloudfunctions2_function_iam_member" "foo" {
146148
147149func testAccCloudfunctions2functionIamPolicy_basicGenerated (context map [string ]interface {}) string {
148150 return Nprintf (`
151+ # [START functions_v2_basic]
149152resource "google_storage_bucket" "bucket" {
150153 provider = google-beta
151- name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}"
154+ name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}" # Every bucket name must be globally unique
152155 location = "US"
153156 uniform_bucket_level_access = true
154157}
@@ -157,7 +160,7 @@ resource "google_storage_bucket_object" "object" {
157160 provider = google-beta
158161 name = "function-source.zip"
159162 bucket = google_storage_bucket.bucket.name
160- source = "%{zip_path}"
163+ source = "%{zip_path}" # Add path to the zipped function source code
161164}
162165
163166resource "google_cloudfunctions2_function" "terraform-test2" {
@@ -168,7 +171,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
168171
169172 build_config {
170173 runtime = "nodejs16"
171- entry_point = "helloHttp"
174+ entry_point = "helloHttp" # Set the entry point
172175 source {
173176 storage_source {
174177 bucket = google_storage_bucket.bucket.name
@@ -183,6 +186,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
183186 timeout_seconds = 60
184187 }
185188}
189+ # [END functions_v2_basic]
186190
187191data "google_iam_policy" "foo" {
188192 provider = google-beta
@@ -203,9 +207,10 @@ resource "google_cloudfunctions2_function_iam_policy" "foo" {
203207
204208func testAccCloudfunctions2functionIamPolicy_emptyBinding (context map [string ]interface {}) string {
205209 return Nprintf (`
210+ # [START functions_v2_basic]
206211resource "google_storage_bucket" "bucket" {
207212 provider = google-beta
208- name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}"
213+ name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}" # Every bucket name must be globally unique
209214 location = "US"
210215 uniform_bucket_level_access = true
211216}
@@ -214,7 +219,7 @@ resource "google_storage_bucket_object" "object" {
214219 provider = google-beta
215220 name = "function-source.zip"
216221 bucket = google_storage_bucket.bucket.name
217- source = "%{zip_path}"
222+ source = "%{zip_path}" # Add path to the zipped function source code
218223}
219224
220225resource "google_cloudfunctions2_function" "terraform-test2" {
@@ -225,7 +230,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
225230
226231 build_config {
227232 runtime = "nodejs16"
228- entry_point = "helloHttp"
233+ entry_point = "helloHttp" # Set the entry point
229234 source {
230235 storage_source {
231236 bucket = google_storage_bucket.bucket.name
@@ -240,6 +245,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
240245 timeout_seconds = 60
241246 }
242247}
248+ # [END functions_v2_basic]
243249
244250data "google_iam_policy" "foo" {
245251 provider = google-beta
@@ -256,9 +262,10 @@ resource "google_cloudfunctions2_function_iam_policy" "foo" {
256262
257263func testAccCloudfunctions2functionIamBinding_basicGenerated (context map [string ]interface {}) string {
258264 return Nprintf (`
265+ # [START functions_v2_basic]
259266resource "google_storage_bucket" "bucket" {
260267 provider = google-beta
261- name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}"
268+ name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}" # Every bucket name must be globally unique
262269 location = "US"
263270 uniform_bucket_level_access = true
264271}
@@ -267,7 +274,7 @@ resource "google_storage_bucket_object" "object" {
267274 provider = google-beta
268275 name = "function-source.zip"
269276 bucket = google_storage_bucket.bucket.name
270- source = "%{zip_path}"
277+ source = "%{zip_path}" # Add path to the zipped function source code
271278}
272279
273280resource "google_cloudfunctions2_function" "terraform-test2" {
@@ -278,7 +285,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
278285
279286 build_config {
280287 runtime = "nodejs16"
281- entry_point = "helloHttp"
288+ entry_point = "helloHttp" # Set the entry point
282289 source {
283290 storage_source {
284291 bucket = google_storage_bucket.bucket.name
@@ -293,6 +300,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
293300 timeout_seconds = 60
294301 }
295302}
303+ # [END functions_v2_basic]
296304
297305resource "google_cloudfunctions2_function_iam_binding" "foo" {
298306 provider = google-beta
@@ -306,9 +314,10 @@ resource "google_cloudfunctions2_function_iam_binding" "foo" {
306314
307315func testAccCloudfunctions2functionIamBinding_updateGenerated (context map [string ]interface {}) string {
308316 return Nprintf (`
317+ # [START functions_v2_basic]
309318resource "google_storage_bucket" "bucket" {
310319 provider = google-beta
311- name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}"
320+ name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}" # Every bucket name must be globally unique
312321 location = "US"
313322 uniform_bucket_level_access = true
314323}
@@ -317,7 +326,7 @@ resource "google_storage_bucket_object" "object" {
317326 provider = google-beta
318327 name = "function-source.zip"
319328 bucket = google_storage_bucket.bucket.name
320- source = "%{zip_path}"
329+ source = "%{zip_path}" # Add path to the zipped function source code
321330}
322331
323332resource "google_cloudfunctions2_function" "terraform-test2" {
@@ -328,7 +337,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
328337
329338 build_config {
330339 runtime = "nodejs16"
331- entry_point = "helloHttp"
340+ entry_point = "helloHttp" # Set the entry point
332341 source {
333342 storage_source {
334343 bucket = google_storage_bucket.bucket.name
@@ -343,6 +352,7 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
343352 timeout_seconds = 60
344353 }
345354}
355+ # [END functions_v2_basic]
346356
347357resource "google_cloudfunctions2_function_iam_binding" "foo" {
348358 provider = google-beta
0 commit comments