Skip to content

Commit

Permalink
Compute and Disk fixes (hashicorp#1)
Browse files Browse the repository at this point in the history
* compute_disk: update image in test

* disk_image: add default type, make size computed

* compute_dis: wait on disk size operations to complete before moving on

* update docks on the image
  • Loading branch information
catsby authored Jun 14, 2017
1 parent 0b9cc31 commit e7c8ecc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 7 additions & 1 deletion google/resource_compute_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func resourceComputeDisk() *schema.Resource {
"size": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},

"self_link": &schema.Schema{
Expand All @@ -85,6 +86,7 @@ func resourceComputeDisk() *schema.Resource {
"type": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "pd-standard",
ForceNew: true,
},
"users": &schema.Schema{
Expand Down Expand Up @@ -197,11 +199,15 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error {
rb := &compute.DisksResizeRequest{
SizeGb: int64(d.Get("size").(int)),
}
_, err := config.clientCompute.Disks.Resize(
op, err := config.clientCompute.Disks.Resize(
project, d.Get("zone").(string), d.Id(), rb).Do()
if err != nil {
return fmt.Errorf("Error resizing disk: %s", err)
}
err = computeOperationWaitZone(config, op, project, d.Get("zone").(string), "Resizing Disk")
if err != nil {
return err
}
}

return resourceComputeDiskRead(d, meta)
Expand Down
2 changes: 1 addition & 1 deletion google/resource_compute_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func testAccComputeDisk_deleteDetach(instanceName, diskName string) string {
return fmt.Sprintf(`
resource "google_compute_disk" "foo" {
name = "%s"
image = "debian-8"
image = "debian-8-jessie-v20170523"
size = 50
type = "pd-ssd"
zone = "us-central1-a"
Expand Down
8 changes: 3 additions & 5 deletions website/docs/r/compute_disk.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "google_compute_disk" "default" {
name = "test-disk"
type = "pd-ssd"
zone = "us-central1-a"
image = "debian-cloud/debian-8"
image = "debian-8-jessie-v20170523"
}
```

Expand All @@ -41,10 +41,8 @@ The following arguments are supported:
to encrypt this disk.

* `image` - (Optional) The image from which to initialize this disk. This can be
one of: the image's `self_link`, `projects/{project}/global/images/{image}`,
`projects/{project}/global/images/family/{family}`, `global/images/{image}`,
`global/images/family/{family}`, `family/{family}`, `{project}/{family}`,
`{project}/{image}`, `{family}`, or `{image}`.
one of: the image's `self_link`, of a full name and version, e.g.
`debian-8-jessie-v20170523`

* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
Expand Down

0 comments on commit e7c8ecc

Please sign in to comment.