Compute and Disk fixes (#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
This commit is contained in:
Clint 2017-06-14 16:31:40 -05:00 committed by GitHub
parent af764c783e
commit a12c0740b1
3 changed files with 11 additions and 7 deletions

View File

@ -69,6 +69,7 @@ func resourceComputeDisk() *schema.Resource {
"size": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"self_link": &schema.Schema{
@ -85,6 +86,7 @@ func resourceComputeDisk() *schema.Resource {
"type": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "pd-standard",
ForceNew: true,
},
"users": &schema.Schema{
@ -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)

View File

@ -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"

View File

@ -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"
}
```
@ -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.