From 8d2ceea5f1a9b5dd63d9f94d3bd3c891d2295510 Mon Sep 17 00:00:00 2001 From: Rickard von Essen Date: Thu, 1 Dec 2016 20:43:15 +0100 Subject: [PATCH] builder/amazon: crash on tagging snapshot when snapshot_tags is unset Closes #4238 --- builder/amazon/common/step_create_tags.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/builder/amazon/common/step_create_tags.go b/builder/amazon/common/step_create_tags.go index a8234b5d3..87ce08840 100644 --- a/builder/amazon/common/step_create_tags.go +++ b/builder/amazon/common/step_create_tags.go @@ -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 }