From 9d75fa72aba677e84dc4638a13de7692d72d9051 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 24 Mar 2015 11:45:20 -0500 Subject: [PATCH] Add disk size to google_compute_instance disk blocks. --- builtin/providers/google/resource_compute_instance.go | 11 +++++++++++ .../providers/google/r/compute_instance.html.markdown | 3 +++ 2 files changed, 14 insertions(+) diff --git a/builtin/providers/google/resource_compute_instance.go b/builtin/providers/google/resource_compute_instance.go index 3b3e86ded..572d77310 100644 --- a/builtin/providers/google/resource_compute_instance.go +++ b/builtin/providers/google/resource_compute_instance.go @@ -74,6 +74,12 @@ func resourceComputeInstance() *schema.Resource { Optional: true, ForceNew: true, }, + + "size": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, }, }, }, @@ -331,6 +337,11 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err disk.InitializeParams.DiskType = diskType.SelfLink } + if v, ok := d.GetOk(prefix + ".size"); ok { + diskSizeGb := v.(int) + disk.InitializeParams.DiskSizeGb = int64(diskSizeGb) + } + disks = append(disks, &disk) } diff --git a/website/source/docs/providers/google/r/compute_instance.html.markdown b/website/source/docs/providers/google/r/compute_instance.html.markdown index 5c6cfe027..3d3104d17 100644 --- a/website/source/docs/providers/google/r/compute_instance.html.markdown +++ b/website/source/docs/providers/google/r/compute_instance.html.markdown @@ -93,6 +93,9 @@ The `disk` block supports: * `type` - (Optional) The GCE disk type. +* `size` - (Optional) The size of the image in gigabytes. If not specified, + it will inherit the size of its base image. + The `network_interface` block supports: * `network` - (Required) The name of the network to attach this interface to.