Add support for setting labels on GCE instance

This commit is contained in:
Patrick Decat 2017-09-06 10:58:08 +02:00
parent 94fafe91ad
commit a7283f2281
4 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,7 @@ type Config struct {
ImageDescription string `mapstructure:"image_description"`
ImageFamily string `mapstructure:"image_family"`
InstanceName string `mapstructure:"instance_name"`
Labels map[string]string `mapstructure:"labels"`
MachineType string `mapstructure:"machine_type"`
Metadata map[string]string `mapstructure:"metadata"`
Network string `mapstructure:"network"`

View File

@ -65,6 +65,7 @@ type InstanceConfig struct {
DiskSizeGb int64
DiskType string
Image *Image
Labels map[string]string
MachineType string
Metadata map[string]string
Name string

View File

@ -407,6 +407,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
},
},
GuestAccelerators: guestAccelerators,
Labels: c.Labels,
MachineType: machineType.SelfLink,
Metadata: &compute.Metadata{
Items: metadata,

View File

@ -106,6 +106,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
DiskSizeGb: c.DiskSizeGb,
DiskType: c.DiskType,
Image: sourceImage,
Labels: c.Labels,
MachineType: c.MachineType,
Metadata: metadata,
Name: name,