diff --git a/builder/googlecompute/driver.go b/builder/googlecompute/driver.go index d55d267b7..b07c9d77b 100644 --- a/builder/googlecompute/driver.go +++ b/builder/googlecompute/driver.go @@ -58,25 +58,24 @@ type Driver interface { } type InstanceConfig struct { - Address string - Description string - DiskSizeGb int64 - DiskType string - Image *Image - MachineType string - Metadata map[string]string - Name string - Network string - NetworkProjectId string - OmitExternalIP bool - OnHostMaintenance string - Preemptible bool - Region string - Scopes []string - ServiceAccountEmail string - Subnetwork string - Tags []string - Zone string + Address string + Description string + DiskSizeGb int64 + DiskType string + Image *Image + MachineType string + Metadata map[string]string + Name string + Network string + NetworkProjectId string + OmitExternalIP bool + OnHostMaintenance string + Preemptible bool + Region string + Scopes []string + Subnetwork string + Tags []string + Zone string } // WindowsPasswordConfig is the data structue that GCE needs to encrypt the created diff --git a/builder/googlecompute/driver_gce.go b/builder/googlecompute/driver_gce.go index c535c139c..0708d0f43 100644 --- a/builder/googlecompute/driver_gce.go +++ b/builder/googlecompute/driver_gce.go @@ -391,7 +391,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { }, ServiceAccounts: []*compute.ServiceAccount{ { - Email: c.ServiceAccountEmail, + Email: "default", Scopes: c.Scopes, }, }, diff --git a/builder/googlecompute/step_create_instance.go b/builder/googlecompute/step_create_instance.go index e7ae63e6d..bbd8867a7 100644 --- a/builder/googlecompute/step_create_instance.go +++ b/builder/googlecompute/step_create_instance.go @@ -99,25 +99,24 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction var metadata map[string]string metadata, err = c.createInstanceMetadata(sourceImage, sshPublicKey) errCh, err = d.RunInstance(&InstanceConfig{ - Address: c.Address, - Description: "New instance created by Packer", - DiskSizeGb: c.DiskSizeGb, - DiskType: c.DiskType, - Image: sourceImage, - MachineType: c.MachineType, - Metadata: metadata, - Name: name, - Network: c.Network, - NetworkProjectId: c.NetworkProjectId, - OmitExternalIP: c.OmitExternalIP, - OnHostMaintenance: c.OnHostMaintenance, - Preemptible: c.Preemptible, - Region: c.Region, - ServiceAccountEmail: c.Account.ClientEmail, - Scopes: c.Scopes, - Subnetwork: c.Subnetwork, - Tags: c.Tags, - Zone: c.Zone, + Address: c.Address, + Description: "New instance created by Packer", + DiskSizeGb: c.DiskSizeGb, + DiskType: c.DiskType, + Image: sourceImage, + MachineType: c.MachineType, + Metadata: metadata, + Name: name, + Network: c.Network, + NetworkProjectId: c.NetworkProjectId, + OmitExternalIP: c.OmitExternalIP, + OnHostMaintenance: c.OnHostMaintenance, + Preemptible: c.Preemptible, + Region: c.Region, + Scopes: c.Scopes, + Subnetwork: c.Subnetwork, + Tags: c.Tags, + Zone: c.Zone, }) if err == nil {