@@ -267,6 +267,37 @@ func TestAccComputeInstance_resourceManagerTags(t *testing.T) {
267
267
})
268
268
}
269
269
270
+ func TestAccComputeInstance_descriptionUpdate (t * testing.T ) {
271
+ t .Parallel ()
272
+
273
+ var instance compute.Instance
274
+ var instanceName = fmt .Sprintf ("tf-test-%s" , acctest .RandString (t , 10 ))
275
+
276
+ acctest .VcrTest (t , resource.TestCase {
277
+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
278
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
279
+ CheckDestroy : testAccCheckComputeInstanceDestroyProducer (t ),
280
+ Steps : []resource.TestStep {
281
+ {
282
+ Config : testAccComputeInstance_description (instanceName ),
283
+ Check : resource .ComposeTestCheckFunc (
284
+ testAccCheckComputeInstanceExists (
285
+ t , "google_compute_instance.foobar" , & instance ),
286
+ resource .TestCheckResourceAttr ("google_compute_instance.foobar" , "description" , "old_desc" ),
287
+ ),
288
+ },
289
+ {
290
+ Config : testAccComputeInstance_descriptionUpdate (instanceName ),
291
+ Check : resource .ComposeTestCheckFunc (
292
+ testAccCheckComputeInstanceExists (
293
+ t , "google_compute_instance.foobar" , & instance ),
294
+ resource .TestCheckResourceAttr ("google_compute_instance.foobar" , "description" , "new_desc" ),
295
+ ),
296
+ },
297
+ },
298
+ })
299
+ }
300
+
270
301
func TestAccComputeInstance_IP (t * testing.T ) {
271
302
t .Parallel ()
272
303
@@ -3466,6 +3497,58 @@ resource "google_compute_instance" "foobar" {
3466
3497
` , instance )
3467
3498
}
3468
3499
3500
+ func testAccComputeInstance_description (instance string ) string {
3501
+ return fmt .Sprintf (`
3502
+ data "google_compute_image" "my_image" {
3503
+ family = "debian-11"
3504
+ project = "debian-cloud"
3505
+ }
3506
+
3507
+ resource "google_compute_instance" "foobar" {
3508
+ name = "%s"
3509
+ machine_type = "e2-medium"
3510
+ zone = "us-central1-a"
3511
+ description = "old_desc"
3512
+
3513
+ boot_disk {
3514
+ initialize_params {
3515
+ image = data.google_compute_image.my_image.self_link
3516
+ }
3517
+ }
3518
+
3519
+ network_interface {
3520
+ network = "default"
3521
+ }
3522
+ }
3523
+ ` , instance )
3524
+ }
3525
+
3526
+ func testAccComputeInstance_descriptionUpdate (instance string ) string {
3527
+ return fmt .Sprintf (`
3528
+ data "google_compute_image" "my_image" {
3529
+ family = "debian-11"
3530
+ project = "debian-cloud"
3531
+ }
3532
+
3533
+ resource "google_compute_instance" "foobar" {
3534
+ name = "%s"
3535
+ machine_type = "e2-medium"
3536
+ zone = "us-central1-a"
3537
+ description = "new_desc"
3538
+
3539
+ boot_disk {
3540
+ initialize_params {
3541
+ image = data.google_compute_image.my_image.self_link
3542
+ }
3543
+ }
3544
+
3545
+ network_interface {
3546
+ network = "default"
3547
+ }
3548
+ }
3549
+ ` , instance )
3550
+ }
3551
+
3469
3552
func testAccComputeInstance_resourceManagerTags (context map [string ]interface {}) string {
3470
3553
return acctest .Nprintf (`
3471
3554
resource "google_tags_tag_key" "key" {
0 commit comments