Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make provisioned_iops Computed true #12058

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/6222.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
compute: fixed force recreation on `provisioned_iops` of `google_compute_disk`
```
1 change: 1 addition & 0 deletions google/resource_compute_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ the supported values for the caller's project.`,
},
"provisioned_iops": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
ForceNew: true,
Description: `Indicates how many IOPS must be provisioned for the disk.`,
Expand Down
31 changes: 31 additions & 0 deletions google/resource_compute_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,27 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) {
})
}

func TestAccComputeDisk_pdExtremeImplicitProvisionedIops(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_pdExtremeImplicitProvisionedIops(diskName),
},
{
ResourceName: "google_compute_disk.foobar",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

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]
Expand Down Expand Up @@ -722,3 +743,13 @@ resource "google_compute_instance_group_manager" "manager" {
}
`, diskName, mgrName)
}

func testAccComputeDisk_pdExtremeImplicitProvisionedIops(diskName string) string {
return fmt.Sprintf(`
resource "google_compute_disk" "foobar" {
name = "%s"
type = "pd-extreme"
size = 1
}
`, diskName)
}