From 36d8a1df1d4a004f9807d3d3343303e12900faf6 Mon Sep 17 00:00:00 2001 From: Roman Zhuzha Date: Wed, 18 Jan 2017 12:52:59 +0100 Subject: [PATCH] use common.ConvertToEC2Tags to apply tags to source EBS volumes, change Say message --- builder/amazon/ebs/step_tag_ebs_volumes.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/builder/amazon/ebs/step_tag_ebs_volumes.go b/builder/amazon/ebs/step_tag_ebs_volumes.go index 2a4f8c047..ecd25e4f0 100644 --- a/builder/amazon/ebs/step_tag_ebs_volumes.go +++ b/builder/amazon/ebs/step_tag_ebs_volumes.go @@ -5,6 +5,7 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/mitchellh/multistep" + "github.com/mitchellh/packer/builder/amazon/common" "github.com/mitchellh/packer/packer" ) @@ -18,7 +19,6 @@ func (s *stepTagEBSVolumes) Run(state multistep.StateBag) multistep.StepAction { ui := state.Get("ui").(packer.Ui) if len(s.VolumeRunTags) > 0 { - ui.Say("Tagging source EBS volumes...") volumeIds := make([]*string, 0) for _, v := range instance.BlockDeviceMappings { @@ -31,10 +31,8 @@ func (s *stepTagEBSVolumes) Run(state multistep.StateBag) multistep.StepAction { return multistep.ActionContinue } - tags := make([]*ec2.Tag, len(s.VolumeRunTags)) - for key, value := range s.VolumeRunTags { - tags = append(tags, &ec2.Tag{Key: &key, Value: &value}) - } + ui.Say(fmt.Sprintf("Adding tags to source EBS Volumes:")) + tags := common.ConvertToEC2Tags(s.VolumeRunTags, ui) _, err := ec2conn.CreateTags(&ec2.CreateTagsInput{ Resources: []*string{