From 139e498962a855b53af276dfd5f0c123e4fcc263 Mon Sep 17 00:00:00 2001 From: Zac Shenker Date: Thu, 3 Apr 2014 15:18:58 -0700 Subject: [PATCH] Changing to the v1 google-api-go-client. Now creates a persistent disk as the boot disk, and sets it to auto delete --- builder/googlecompute/driver_gce.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/builder/googlecompute/driver_gce.go b/builder/googlecompute/driver_gce.go index 6ab3929e3..24b540e51 100644 --- a/builder/googlecompute/driver_gce.go +++ b/builder/googlecompute/driver_gce.go @@ -8,7 +8,7 @@ import ( "code.google.com/p/goauth2/oauth" "code.google.com/p/goauth2/oauth/jwt" - "code.google.com/p/google-api-go-client/compute/v1beta16" + "code.google.com/p/google-api-go-client/compute/v1" "github.com/mitchellh/packer/packer" ) @@ -168,7 +168,18 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { // Create the instance information instance := compute.Instance{ Description: c.Description, - Image: image.SelfLink, + Disks: []*compute.AttachedDisk{ + &compute.AttachedDisk{ + Type: "PERSISTENT", + Mode: "READ_WRITE", + Kind: "compute#attachedDisk", + Boot: true, + AutoDelete: true, + InitializeParams: &compute.AttachedDiskInitializeParams{ + SourceImage: image.SelfLink, + }, + }, + }, MachineType: machineType.SelfLink, Metadata: &compute.Metadata{ Items: metadata,