diff --git a/builder/amazon/common/step_run_spot_instance.go b/builder/amazon/common/step_run_spot_instance.go index 2af83d98f..b34d09bcb 100644 --- a/builder/amazon/common/step_run_spot_instance.go +++ b/builder/amazon/common/step_run_spot_instance.go @@ -278,7 +278,7 @@ func (s *StepRunSpotInstance) Run(state multistep.StateBag) multistep.StepAction } } - if len(volumeIds) > 0 { + if len(volumeIds) > 0 && len(s.VolumeTags) > 0 { ui.Say("Adding tags to source EBS Volumes") tags, err := ConvertToEC2Tags(s.VolumeTags, *ec2conn.Config.Region, s.SourceAMI, s.Ctx) if err != nil { diff --git a/builder/amazon/ebsvolume/builder.go b/builder/amazon/ebsvolume/builder.go index 7cab85e91..375511082 100644 --- a/builder/amazon/ebsvolume/builder.go +++ b/builder/amazon/ebsvolume/builder.go @@ -116,6 +116,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: b.config.launchBlockDevices, Tags: b.config.RunTags, Ctx: b.config.ctx, InstanceInitiatedShutdownBehavior: b.config.InstanceInitiatedShutdownBehavior, @@ -135,6 +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: b.config.launchBlockDevices, Tags: b.config.RunTags, Ctx: b.config.ctx, InstanceInitiatedShutdownBehavior: b.config.InstanceInitiatedShutdownBehavior, @@ -164,6 +166,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe TemporarySGSourceCidr: b.config.TemporarySGSourceCidr, }, instanceStep, + &stepTagEBSVolumes{ + VolumeMapping: b.config.VolumeMappings, + Ctx: b.config.ctx, + }, &awscommon.StepGetPassword{ Debug: b.config.PackerDebug, Comm: &b.config.RunConfig.Comm, diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index 9500867ef..7cee44c09 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -199,7 +199,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe if b.config.SpotPrice == "" || b.config.SpotPrice == "0" { instanceStep = &awscommon.StepRunSourceInstance{ Debug: b.config.PackerDebug, - ExpectedRootDevice: "ebs", InstanceType: b.config.InstanceType, UserData: b.config.UserData, UserDataFile: b.config.UserDataFile, @@ -212,12 +211,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe BlockDevices: b.config.BlockDevices, Tags: b.config.RunTags, Ctx: b.config.ctx, - InstanceInitiatedShutdownBehavior: b.config.InstanceInitiatedShutdownBehavior, } } else { instanceStep = &awscommon.StepRunSpotInstance{ Debug: b.config.PackerDebug, - ExpectedRootDevice: "ebs", SpotPrice: b.config.SpotPrice, SpotPriceProduct: b.config.SpotPriceAutoProduct, InstanceType: b.config.InstanceType, @@ -232,7 +229,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe BlockDevices: b.config.BlockDevices, Tags: b.config.RunTags, Ctx: b.config.ctx, - InstanceInitiatedShutdownBehavior: b.config.InstanceInitiatedShutdownBehavior, } }