Merge branch 'googlecompute-disk-type' of https://github.com/meatballhat/packer into f-google-disk-type
This commit is contained in:
commit
1b1bbb604e
|
@ -25,6 +25,7 @@ type Config struct {
|
|||
|
||||
DiskName string `mapstructure:"disk_name"`
|
||||
DiskSizeGb int64 `mapstructure:"disk_size"`
|
||||
DiskType string `mapstructure:"disk_type"`
|
||||
ImageName string `mapstructure:"image_name"`
|
||||
ImageDescription string `mapstructure:"image_description"`
|
||||
InstanceName string `mapstructure:"instance_name"`
|
||||
|
@ -74,6 +75,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
c.DiskSizeGb = 10
|
||||
}
|
||||
|
||||
if c.DiskType == "" {
|
||||
c.DiskType = "pd-standard"
|
||||
}
|
||||
|
||||
if c.ImageDescription == "" {
|
||||
c.ImageDescription = "Created by Packer"
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ type Image struct {
|
|||
type InstanceConfig struct {
|
||||
Description string
|
||||
DiskSizeGb int64
|
||||
DiskType string
|
||||
Image Image
|
||||
MachineType string
|
||||
Metadata map[string]string
|
||||
|
|
|
@ -274,6 +274,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
|
|||
InitializeParams: &compute.AttachedDiskInitializeParams{
|
||||
SourceImage: image.SelfLink,
|
||||
DiskSizeGb: c.DiskSizeGb,
|
||||
DiskType: fmt.Sprintf("zones/%s/diskTypes/%s", zone.Name, c.DiskType),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -54,6 +54,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
|
|||
errCh, err := driver.RunInstance(&InstanceConfig{
|
||||
Description: "New instance created by Packer",
|
||||
DiskSizeGb: config.DiskSizeGb,
|
||||
DiskType: config.DiskType,
|
||||
Image: config.getImage(),
|
||||
MachineType: config.MachineType,
|
||||
Metadata: config.getInstanceMetadata(sshPublicKey),
|
||||
|
|
Loading…
Reference in New Issue