From 7e1646826d6bc3f95b3bb38409bac0b139ffe596 Mon Sep 17 00:00:00 2001 From: Mark Meyer Date: Mon, 23 Oct 2017 21:10:40 +0200 Subject: [PATCH 1/4] Check if VolumeTags is empty before tagging volumes Related to #5486 --- builder/amazon/common/step_run_spot_instance.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From 1cc9b3f1e3d973326185a840557435758dfbe259 Mon Sep 17 00:00:00 2001 From: Mark Meyer Date: Mon, 23 Oct 2017 21:40:35 +0200 Subject: [PATCH 2/4] Bring back volume tagging to ebsvolume Related to #5486 --- builder/amazon/ebsvolume/builder.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builder/amazon/ebsvolume/builder.go b/builder/amazon/ebsvolume/builder.go index 7cab85e91..cf2993538 100644 --- a/builder/amazon/ebsvolume/builder.go +++ b/builder/amazon/ebsvolume/builder.go @@ -164,6 +164,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, From 309bf61257abbcec697221ea2b75ad2d0688a109 Mon Sep 17 00:00:00 2001 From: Mark Meyer Date: Mon, 23 Oct 2017 22:33:16 +0200 Subject: [PATCH 3/4] Add missing blockdevices to ebsvolume builder --- builder/amazon/ebsvolume/builder.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builder/amazon/ebsvolume/builder.go b/builder/amazon/ebsvolume/builder.go index cf2993538..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, From 4c5df7922203a6ed14b7854b28f2a6a3bff00406 Mon Sep 17 00:00:00 2001 From: Mark Meyer Date: Tue, 24 Oct 2017 23:22:50 +0200 Subject: [PATCH 4/4] Fix regressions introduced in the instance builder Related to #5504 --- builder/amazon/instance/builder.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index ebc93751e..bd534599b 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -198,7 +198,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, @@ -211,12 +210,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, @@ -231,7 +228,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, } }