Merge pull request #5308 from pdecat/f-gce-instance-labels

Add support for setting labels on GCE instance
This commit is contained in:
Matthew Hooker 2017-09-06 14:59:40 -07:00 committed by GitHub
commit 57237c55e6
5 changed files with 7 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,

View File

@ -204,6 +204,9 @@ builder.
- `instance_name` (string) - A name to give the launched instance. Beware that
this must be unique. Defaults to `"packer-{{uuid}}"`.
- `labels` (object of key/value strings) - Labels applied to the launched
instance.
- `machine_type` (string) - The machine type. Defaults to `"n1-standard-1"`.
- `metadata` (object of key/value strings) - Metadata applied to the launched