builder/amazon: crash on tagging snapshot when snapshot_tags is unset

Closes #4238
This commit is contained in:
Rickard von Essen 2016-12-01 20:43:15 +01:00
parent c2512d232a
commit 8d2ceea5f1
1 changed files with 6 additions and 4 deletions

View File

@ -96,10 +96,12 @@ func (s *StepCreateTags) Run(state multistep.StateBag) multistep.StepAction {
}
// Override tags on snapshots
_, err = regionconn.CreateTags(&ec2.CreateTagsInput{
Resources: snapshotIds,
Tags: snapshotTags,
})
if len(snapshotTags) > 0 {
_, err = regionconn.CreateTags(&ec2.CreateTagsInput{
Resources: snapshotIds,
Tags: snapshotTags,
})
}
if err == nil {
return true, nil
}