Skip to content

Commit

Permalink
make provisioned_iops Computed true (#6222) (#12058)
Browse files Browse the repository at this point in the history
* make provisioned_iops Computed true

* update test case name

Co-authored-by: Edward Sun <sunedward@google.com>
Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Edward Sun <sunedward@google.com>
  • Loading branch information
modular-magician and Edward Sun committed Jul 8, 2022
1 parent a062da3 commit 48ee31a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
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)
}

0 comments on commit 48ee31a

Please sign in to comment.