@@ -80,6 +80,14 @@ resource "google_workbench_instance" "instance" {
8080 enable_integrity_monitoring = false
8181 }
8282
83+ boot_disk {
84+ disk_size_gb = 310
85+ }
86+
87+ data_disks {
88+ disk_size_gb = 330
89+ }
90+
8391 metadata = {
8492 terraform = "true"
8593 }
@@ -449,3 +457,172 @@ resource "google_workbench_instance" "instance" {
449457}
450458` , context )
451459}
460+
461+ func TestAccWorkbenchInstance_updateBootDisk (t * testing.T ) {
462+ t .Parallel ()
463+
464+ context := map [string ]interface {}{
465+ "random_suffix" : acctest .RandString (t , 10 ),
466+ }
467+
468+ acctest .VcrTest (t , resource.TestCase {
469+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
470+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
471+ Steps : []resource.TestStep {
472+ {
473+ Config : testAccWorkbenchInstance_basic (context ),
474+ Check : resource .ComposeTestCheckFunc (
475+ resource .TestCheckResourceAttr (
476+ "google_workbench_instance.instance" , "state" , "ACTIVE" ),
477+ ),
478+ },
479+ {
480+ ResourceName : "google_workbench_instance.instance" ,
481+ ImportState : true ,
482+ ImportStateVerify : true ,
483+ ImportStateVerifyIgnore : []string {"name" , "instance_owners" , "location" , "instance_id" , "request_id" , "labels" , "terraform_labels" , "desired_state" },
484+ },
485+ {
486+ Config : testAccWorkbenchInstance_updateBootDisk (context ),
487+ Check : resource .ComposeTestCheckFunc (
488+ resource .TestCheckResourceAttr (
489+ "google_workbench_instance.instance" , "state" , "ACTIVE" ),
490+ ),
491+ },
492+ {
493+ ResourceName : "google_workbench_instance.instance" ,
494+ ImportState : true ,
495+ ImportStateVerify : true ,
496+ ImportStateVerifyIgnore : []string {"name" , "instance_owners" , "location" , "instance_id" , "request_id" , "labels" , "terraform_labels" , "desired_state" },
497+ },
498+ },
499+ })
500+ }
501+
502+ func TestAccWorkbenchInstance_updateDataDisk (t * testing.T ) {
503+ t .Parallel ()
504+
505+ context := map [string ]interface {}{
506+ "random_suffix" : acctest .RandString (t , 10 ),
507+ }
508+
509+ acctest .VcrTest (t , resource.TestCase {
510+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
511+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
512+ Steps : []resource.TestStep {
513+ {
514+ Config : testAccWorkbenchInstance_basic (context ),
515+ Check : resource .ComposeTestCheckFunc (
516+ resource .TestCheckResourceAttr (
517+ "google_workbench_instance.instance" , "state" , "ACTIVE" ),
518+ ),
519+ },
520+ {
521+ ResourceName : "google_workbench_instance.instance" ,
522+ ImportState : true ,
523+ ImportStateVerify : true ,
524+ ImportStateVerifyIgnore : []string {"name" , "instance_owners" , "location" , "instance_id" , "request_id" , "labels" , "terraform_labels" , "desired_state" },
525+ },
526+ {
527+ Config : testAccWorkbenchInstance_updateDataDisk (context ),
528+ Check : resource .ComposeTestCheckFunc (
529+ resource .TestCheckResourceAttr (
530+ "google_workbench_instance.instance" , "state" , "ACTIVE" ),
531+ ),
532+ },
533+ {
534+ ResourceName : "google_workbench_instance.instance" ,
535+ ImportState : true ,
536+ ImportStateVerify : true ,
537+ ImportStateVerifyIgnore : []string {"name" , "instance_owners" , "location" , "instance_id" , "request_id" , "labels" , "terraform_labels" , "desired_state" },
538+ },
539+ },
540+ })
541+ }
542+
543+ func TestAccWorkbenchInstance_updateBothDisks (t * testing.T ) {
544+ t .Parallel ()
545+
546+ context := map [string ]interface {}{
547+ "random_suffix" : acctest .RandString (t , 10 ),
548+ }
549+
550+ acctest .VcrTest (t , resource.TestCase {
551+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
552+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
553+ Steps : []resource.TestStep {
554+ {
555+ Config : testAccWorkbenchInstance_basic (context ),
556+ Check : resource .ComposeTestCheckFunc (
557+ resource .TestCheckResourceAttr (
558+ "google_workbench_instance.instance" , "state" , "ACTIVE" ),
559+ ),
560+ },
561+ {
562+ ResourceName : "google_workbench_instance.instance" ,
563+ ImportState : true ,
564+ ImportStateVerify : true ,
565+ ImportStateVerifyIgnore : []string {"name" , "instance_owners" , "location" , "instance_id" , "request_id" , "labels" , "terraform_labels" , "desired_state" },
566+ },
567+ {
568+ Config : testAccWorkbenchInstance_updateBothDisks (context ),
569+ Check : resource .ComposeTestCheckFunc (
570+ resource .TestCheckResourceAttr (
571+ "google_workbench_instance.instance" , "state" , "ACTIVE" ),
572+ ),
573+ },
574+ {
575+ ResourceName : "google_workbench_instance.instance" ,
576+ ImportState : true ,
577+ ImportStateVerify : true ,
578+ ImportStateVerifyIgnore : []string {"name" , "instance_owners" , "location" , "instance_id" , "request_id" , "labels" , "terraform_labels" , "desired_state" },
579+ },
580+ },
581+ })
582+ }
583+
584+ func testAccWorkbenchInstance_updateBootDisk (context map [string ]interface {}) string {
585+ return acctest .Nprintf (`
586+ resource "google_workbench_instance" "instance" {
587+ name = "tf-test-workbench-instance%{random_suffix}"
588+ location = "us-central1-a"
589+ gce_setup {
590+ boot_disk {
591+ disk_size_gb = 310
592+ }
593+ }
594+ }
595+ ` , context )
596+ }
597+
598+ func testAccWorkbenchInstance_updateDataDisk (context map [string ]interface {}) string {
599+ return acctest .Nprintf (`
600+ resource "google_workbench_instance" "instance" {
601+ name = "tf-test-workbench-instance%{random_suffix}"
602+ location = "us-central1-a"
603+ gce_setup {
604+ data_disks {
605+ disk_size_gb = 330
606+ }
607+ }
608+ }
609+ ` , context )
610+ }
611+
612+ func testAccWorkbenchInstance_updateBothDisks (context map [string ]interface {}) string {
613+ return acctest .Nprintf (`
614+ resource "google_workbench_instance" "instance" {
615+ name = "tf-test-workbench-instance%{random_suffix}"
616+ location = "us-central1-a"
617+ gce_setup {
618+ boot_disk {
619+ disk_size_gb = 310
620+ }
621+
622+ data_disks {
623+ disk_size_gb = 330
624+ }
625+ }
626+ }
627+ ` , context )
628+ }
0 commit comments