Skip to content

Commit 48ee31a

Browse files
modular-magicianEdward Sun
and
Edward Sun
authored
make provisioned_iops Computed true (#6222) (#12058)
* make provisioned_iops Computed true * update test case name Co-authored-by: Edward Sun <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Edward Sun <[email protected]>
1 parent a062da3 commit 48ee31a

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

.changelog/6222.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
compute: fixed force recreation on `provisioned_iops` of `google_compute_disk`
3+
```

google/resource_compute_disk.go

+1
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ the supported values for the caller's project.`,
363363
},
364364
"provisioned_iops": {
365365
Type: schema.TypeInt,
366+
Computed: true,
366367
Optional: true,
367368
ForceNew: true,
368369
Description: `Indicates how many IOPS must be provisioned for the disk.`,

google/resource_compute_disk_test.go

+31
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,27 @@ func TestAccComputeDisk_deleteDetachIGM(t *testing.T) {
437437
})
438438
}
439439

440+
func TestAccComputeDisk_pdExtremeImplicitProvisionedIops(t *testing.T) {
441+
t.Parallel()
442+
443+
diskName := fmt.Sprintf("tf-test-%s", randString(t, 10))
444+
445+
vcrTest(t, resource.TestCase{
446+
PreCheck: func() { testAccPreCheck(t) },
447+
Providers: testAccProviders,
448+
Steps: []resource.TestStep{
449+
{
450+
Config: testAccComputeDisk_pdExtremeImplicitProvisionedIops(diskName),
451+
},
452+
{
453+
ResourceName: "google_compute_disk.foobar",
454+
ImportState: true,
455+
ImportStateVerify: true,
456+
},
457+
},
458+
})
459+
}
460+
440461
func testAccCheckComputeDiskExists(t *testing.T, n, p string, disk *compute.Disk) resource.TestCheckFunc {
441462
return func(s *terraform.State) error {
442463
rs, ok := s.RootModule().Resources[n]
@@ -722,3 +743,13 @@ resource "google_compute_instance_group_manager" "manager" {
722743
}
723744
`, diskName, mgrName)
724745
}
746+
747+
func testAccComputeDisk_pdExtremeImplicitProvisionedIops(diskName string) string {
748+
return fmt.Sprintf(`
749+
resource "google_compute_disk" "foobar" {
750+
name = "%s"
751+
type = "pd-extreme"
752+
size = 1
753+
}
754+
`, diskName)
755+
}

0 commit comments

Comments
 (0)