Merge pull request #4749 from rickard-von-essen/issue-4608

builder/googlecompute: Revert to using default service account
This commit is contained in:
Matthew Hooker 2017-04-03 11:22:34 -07:00 committed by GitHub
commit 4a38f0d353
3 changed files with 37 additions and 39 deletions

View File

@ -58,25 +58,24 @@ type Driver interface {
} }
type InstanceConfig struct { type InstanceConfig struct {
Address string Address string
Description string Description string
DiskSizeGb int64 DiskSizeGb int64
DiskType string DiskType string
Image *Image Image *Image
MachineType string MachineType string
Metadata map[string]string Metadata map[string]string
Name string Name string
Network string Network string
NetworkProjectId string NetworkProjectId string
OmitExternalIP bool OmitExternalIP bool
OnHostMaintenance string OnHostMaintenance string
Preemptible bool Preemptible bool
Region string Region string
Scopes []string Scopes []string
ServiceAccountEmail string Subnetwork string
Subnetwork string Tags []string
Tags []string Zone string
Zone string
} }
// WindowsPasswordConfig is the data structue that GCE needs to encrypt the created // WindowsPasswordConfig is the data structue that GCE needs to encrypt the created

View File

@ -391,7 +391,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
}, },
ServiceAccounts: []*compute.ServiceAccount{ ServiceAccounts: []*compute.ServiceAccount{
{ {
Email: c.ServiceAccountEmail, Email: "default",
Scopes: c.Scopes, Scopes: c.Scopes,
}, },
}, },

View File

@ -99,25 +99,24 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
var metadata map[string]string var metadata map[string]string
metadata, err = c.createInstanceMetadata(sourceImage, sshPublicKey) metadata, err = c.createInstanceMetadata(sourceImage, sshPublicKey)
errCh, err = d.RunInstance(&InstanceConfig{ errCh, err = d.RunInstance(&InstanceConfig{
Address: c.Address, Address: c.Address,
Description: "New instance created by Packer", Description: "New instance created by Packer",
DiskSizeGb: c.DiskSizeGb, DiskSizeGb: c.DiskSizeGb,
DiskType: c.DiskType, DiskType: c.DiskType,
Image: sourceImage, Image: sourceImage,
MachineType: c.MachineType, MachineType: c.MachineType,
Metadata: metadata, Metadata: metadata,
Name: name, Name: name,
Network: c.Network, Network: c.Network,
NetworkProjectId: c.NetworkProjectId, NetworkProjectId: c.NetworkProjectId,
OmitExternalIP: c.OmitExternalIP, OmitExternalIP: c.OmitExternalIP,
OnHostMaintenance: c.OnHostMaintenance, OnHostMaintenance: c.OnHostMaintenance,
Preemptible: c.Preemptible, Preemptible: c.Preemptible,
Region: c.Region, Region: c.Region,
ServiceAccountEmail: c.Account.ClientEmail, Scopes: c.Scopes,
Scopes: c.Scopes, Subnetwork: c.Subnetwork,
Subnetwork: c.Subnetwork, Tags: c.Tags,
Tags: c.Tags, Zone: c.Zone,
Zone: c.Zone,
}) })
if err == nil { if err == nil {