Skip to content

Commit e7c8ecc

Browse files
authored
Compute and Disk fixes (hashicorp#1)
* 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
1 parent 0b9cc31 commit e7c8ecc

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

google/resource_compute_disk.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func resourceComputeDisk() *schema.Resource {
6969
"size": &schema.Schema{
7070
Type: schema.TypeInt,
7171
Optional: true,
72+
Computed: true,
7273
},
7374

7475
"self_link": &schema.Schema{
@@ -85,6 +86,7 @@ func resourceComputeDisk() *schema.Resource {
8586
"type": &schema.Schema{
8687
Type: schema.TypeString,
8788
Optional: true,
89+
Default: "pd-standard",
8890
ForceNew: true,
8991
},
9092
"users": &schema.Schema{
@@ -197,11 +199,15 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error {
197199
rb := &compute.DisksResizeRequest{
198200
SizeGb: int64(d.Get("size").(int)),
199201
}
200-
_, err := config.clientCompute.Disks.Resize(
202+
op, err := config.clientCompute.Disks.Resize(
201203
project, d.Get("zone").(string), d.Id(), rb).Do()
202204
if err != nil {
203205
return fmt.Errorf("Error resizing disk: %s", err)
204206
}
207+
err = computeOperationWaitZone(config, op, project, d.Get("zone").(string), "Resizing Disk")
208+
if err != nil {
209+
return err
210+
}
205211
}
206212

207213
return resourceComputeDiskRead(d, meta)

google/resource_compute_disk_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ func testAccComputeDisk_deleteDetach(instanceName, diskName string) string {
292292
return fmt.Sprintf(`
293293
resource "google_compute_disk" "foo" {
294294
name = "%s"
295-
image = "debian-8"
295+
image = "debian-8-jessie-v20170523"
296296
size = 50
297297
type = "pd-ssd"
298298
zone = "us-central1-a"

website/docs/r/compute_disk.html.markdown

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ resource "google_compute_disk" "default" {
2020
name = "test-disk"
2121
type = "pd-ssd"
2222
zone = "us-central1-a"
23-
image = "debian-cloud/debian-8"
23+
image = "debian-8-jessie-v20170523"
2424
}
2525
```
2626

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

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

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

0 commit comments

Comments
 (0)