apply source instance default "Name" tag only if it's not provided in run_tags

This commit is contained in:
Roman Zhuzha 2017-01-18 12:55:18 +01:00
parent 36d8a1df1d
commit a65af51a4b
1 changed files with 3 additions and 1 deletions

View File

@ -292,7 +292,9 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
instance := latestInstance.(*ec2.Instance)
ui.Say(fmt.Sprintf("Adding tags to source instance:"))
s.Tags["Name"] = "Packer Builder"
if _, exists := s.Tags["Name"]; !exists {
s.Tags["Name"] = "Packer Builder"
}
ec2Tags := ConvertToEC2Tags(s.Tags, ui)
_, err = ec2conn.CreateTags(&ec2.CreateTagsInput{