From 5a5d9471ab3211e03dfa24d19e63bd6ab7bc7118 Mon Sep 17 00:00:00 2001 From: Megan Bang Date: Thu, 15 Oct 2020 15:57:29 -0500 Subject: [PATCH] add attribute to google_compute_disk --- products/compute/api.yaml | 9 ++++ .../tests/resource_compute_disk_test.go.erb | 41 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/products/compute/api.yaml b/products/compute/api.yaml index c8e83539ec86..a28b967c4442 100644 --- a/products/compute/api.yaml +++ b/products/compute/api.yaml @@ -2909,6 +2909,15 @@ objects: are 4096 and 16384, other sizes may be added in the future. If an unsupported value is requested, the error message will list the supported values for the caller's project. + - !ruby/object:Api::Type::Enum + name: 'interface' + min_version: 'beta' + description: | + Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME. The default is SCSI. + default_value: :SCSI + values: + - :SCSI + - :NVME - !ruby/object:Api::Type::ResourceRef name: 'type' resource: 'DiskType' 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 f687ff1fe6c7..bcbeba826d71 100644 --- a/third_party/terraform/tests/resource_compute_disk_test.go.erb +++ b/third_party/terraform/tests/resource_compute_disk_test.go.erb @@ -457,6 +457,29 @@ func TestAccComputeDisk_resourcePolicies(t *testing.T) { } <% end -%> +<% unless version == 'ga' -%> +func TestAccComputeDisk_interface(t *testing.T) { + t.Parallel() + + diskName := fmt.Sprintf("tf-test-%s", randString(t, 10)) + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccComputeDisk_interface(diskName), + }, + { + 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] @@ -774,4 +797,22 @@ resource "google_compute_disk" "foobar" { } `, policyName, diskName) } + +func testAccComputeDisk_interface(diskName string) string { + return fmt.Sprintf(` +data "google_compute_image" "my_image" { + family = "debian-9" + project = "debian-cloud" +} + +resource "google_compute_disk" "foobar" { + name = "%s" + image = data.google_compute_image.my_image.self_link + size = 50 + type = "pd-ssd" + zone = "us-central1-a" + interface = "NVME" +} +`, diskName) +} <% end -%>