|
|
|
|
@ -28,7 +28,8 @@ type Config struct {
|
|
|
|
|
VolumeMappings []BlockDevice `mapstructure:"ebs_volumes"`
|
|
|
|
|
AMIEnhancedNetworking bool `mapstructure:"enhanced_networking"`
|
|
|
|
|
|
|
|
|
|
ctx interpolate.Context
|
|
|
|
|
launchBlockDevices awscommon.BlockDevices
|
|
|
|
|
ctx interpolate.Context
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Builder struct {
|
|
|
|
|
@ -57,6 +58,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...)
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, b.config.RunConfig.Prepare(&b.config.ctx)...)
|
|
|
|
|
|
|
|
|
|
b.config.launchBlockDevices, err = commonBlockDevices(b.config.VolumeMappings, &b.config.ctx)
|
|
|
|
|
if err != nil {
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if errs != nil && len(errs.Errors) > 0 {
|
|
|
|
|
return nil, errs
|
|
|
|
|
}
|
|
|
|
|
@ -96,8 +102,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|
|
|
|
state.Put("hook", hook)
|
|
|
|
|
state.Put("ui", ui)
|
|
|
|
|
|
|
|
|
|
launchBlockDevices := commonBlockDevices(b.config.VolumeMappings)
|
|
|
|
|
|
|
|
|
|
// Build the steps
|
|
|
|
|
steps := []multistep.Step{
|
|
|
|
|
&awscommon.StepSourceAMIInfo{
|
|
|
|
|
@ -132,7 +136,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|
|
|
|
AssociatePublicIpAddress: b.config.AssociatePublicIpAddress,
|
|
|
|
|
EbsOptimized: b.config.EbsOptimized,
|
|
|
|
|
AvailabilityZone: b.config.AvailabilityZone,
|
|
|
|
|
BlockDevices: launchBlockDevices,
|
|
|
|
|
BlockDevices: b.config.launchBlockDevices,
|
|
|
|
|
Tags: b.config.RunTags,
|
|
|
|
|
Ctx: b.config.ctx,
|
|
|
|
|
InstanceInitiatedShutdownBehavior: b.config.InstanceInitiatedShutdownBehavior,
|
|
|
|
|
|