use ConvertToEC2Tags to apply tags to source instance, add Say message

This commit is contained in:
Roman Zhuzha 2017-01-18 11:36:31 +00:00
parent 332cb784fd
commit aa70c82ec8
1 changed files with 3 additions and 5 deletions

View File

@ -291,11 +291,9 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
instance := latestInstance.(*ec2.Instance) instance := latestInstance.(*ec2.Instance)
ec2Tags := make([]*ec2.Tag, 1, len(s.Tags)+1) ui.Say(fmt.Sprintf("Adding tags to source instance:"))
ec2Tags[0] = &ec2.Tag{Key: aws.String("Name"), Value: aws.String("Packer Builder")} s.Tags["Name"] = "Packer Builder"
for k, v := range s.Tags { ec2Tags := ConvertToEC2Tags(s.Tags, ui)
ec2Tags = append(ec2Tags, &ec2.Tag{Key: aws.String(k), Value: aws.String(v)})
}
_, err = ec2conn.CreateTags(&ec2.CreateTagsInput{ _, err = ec2conn.CreateTags(&ec2.CreateTagsInput{
Tags: ec2Tags, Tags: ec2Tags,