@@ -480,6 +480,29 @@ func TestAccComputeDisk_interface(t *testing.T) {
480480}
481481<% end -%>
482482
483+ <% unless version == 'ga' -%>
484+ func TestAccComputeDisk_multiWriter(t *testing.T) {
485+ t.Parallel()
486+ instanceName := fmt.Sprintf("tf-test-%s", randString(t, 10))
487+ diskName := fmt.Sprintf("tf-testd-%s", randString(t, 10))
488+
489+ vcrTest(t, resource.TestCase{
490+ PreCheck: func() { testAccPreCheck(t) },
491+ Providers: testAccProviders,
492+ Steps: []resource.TestStep{
493+ {
494+ Config: testAccComputeDisk_multiWriter(instanceName, diskName, true),
495+ },
496+ {
497+ ResourceName: "google_compute_disk.foobar",
498+ ImportState: true,
499+ ImportStateVerify: true,
500+ },
501+ },
502+ })
503+ }
504+ <% end -%>
505+
483506func testAccCheckComputeDiskExists(t *testing.T, n, p string, disk *compute.Disk) resource.TestCheckFunc {
484507 return func(s *terraform.State) error {
485508 rs, ok := s.RootModule().Resources[n]
@@ -816,3 +839,48 @@ resource "google_compute_disk" "foobar" {
816839`, diskName)
817840}
818841<% end -%>
842+
843+ <% unless version == 'ga' -%>
844+ func testAccComputeDisk_multiWriter(instance string, diskName string, enableMultiwriter bool) string {
845+ return fmt.Sprintf(`
846+ data "google_compute_image" "my_image" {
847+ family = "debian-9"
848+ project = "debian-cloud"
849+ }
850+
851+ resource "google_compute_disk" "foobar" {
852+ name = "%s"
853+ size = 10
854+ type = "pd-ssd"
855+ zone = "us-central1-a"
856+ multi_writer = %t
857+ }
858+
859+ resource "google_compute_instance" "foobar" {
860+ name = "%s"
861+ machine_type = "n2-standard-2"
862+ zone = "us-central1-a"
863+ can_ip_forward = false
864+ tags = ["foo", "bar"]
865+
866+ boot_disk {
867+ initialize_params {
868+ image = data.google_compute_image.my_image.self_link
869+ }
870+ }
871+
872+ attached_disk {
873+ source = google_compute_disk.foobar.name
874+ }
875+
876+ network_interface {
877+ network = "default"
878+ }
879+
880+ metadata = {
881+ foo = "bar"
882+ }
883+ }
884+ `, diskName, enableMultiwriter, instance)
885+ }
886+ <% end -%>
0 commit comments