diff --git a/products/compute/api.yaml b/products/compute/api.yaml index 7fbf046d917c..3c14d6f38f23 100644 --- a/products/compute/api.yaml +++ b/products/compute/api.yaml @@ -3274,6 +3274,11 @@ objects: resource: 'ResourcePolicy' imports: 'selfLink' description: 'A resource policy applied to this disk for automatic snapshot creations.' + - !ruby/object:Api::Type::Boolean + name: 'multiWriter' + description: | + Indicates whether or not the disk can be read/write attached to more than one instance. + min_version: beta - !ruby/object:Api::Resource name: 'Firewall' kind: 'compute#firewall' diff --git a/third_party/terraform/tests/resource_compute_disk_test.go.erb b/third_party/terraform/tests/resource_compute_disk_test.go.erb index bcbeba826d71..e7ce12c1bba6 100644 --- a/third_party/terraform/tests/resource_compute_disk_test.go.erb +++ b/third_party/terraform/tests/resource_compute_disk_test.go.erb @@ -480,6 +480,29 @@ func TestAccComputeDisk_interface(t *testing.T) { } <% end -%> +<% unless version == 'ga' -%> +func TestAccComputeDisk_multiWriter(t *testing.T) { + t.Parallel() + instanceName := fmt.Sprintf("tf-test-%s", randString(t, 10)) + diskName := fmt.Sprintf("tf-testd-%s", randString(t, 10)) + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccComputeDisk_multiWriter(instanceName, diskName, true), + }, + { + ResourceName: "google_compute_disk.foobar", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} +<% end -%> + func testAccCheckComputeDiskExists(t *testing.T, n, p string, disk *compute.Disk) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -816,3 +839,48 @@ resource "google_compute_disk" "foobar" { `, diskName) } <% end -%> + +<% unless version == 'ga' -%> +func testAccComputeDisk_multiWriter(instance string, diskName string, enableMultiwriter bool) string { + return fmt.Sprintf(` +data "google_compute_image" "my_image" { + family = "debian-9" + project = "debian-cloud" +} + +resource "google_compute_disk" "foobar" { + name = "%s" + size = 10 + type = "pd-ssd" + zone = "us-central1-a" + multi_writer = %t +} + +resource "google_compute_instance" "foobar" { + name = "%s" + machine_type = "n2-standard-2" + zone = "us-central1-a" + can_ip_forward = false + tags = ["foo", "bar"] + + boot_disk { + initialize_params { + image = data.google_compute_image.my_image.self_link + } + } + + attached_disk { + source = google_compute_disk.foobar.name + } + + network_interface { + network = "default" + } + + metadata = { + foo = "bar" + } +} +`, diskName, enableMultiwriter, instance) +} +<% end -%> \ No newline at end of file