From c537623bc60c2526d01888b0b684add62bbe4041 Mon Sep 17 00:00:00 2001 From: Jani Jappinen Date: Thu, 25 Jun 2015 17:25:28 +0300 Subject: [PATCH] Fix failing AMI snapshot tagging when copying to other regions. --- builder/amazon/common/step_create_tags.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builder/amazon/common/step_create_tags.go b/builder/amazon/common/step_create_tags.go index 7c89e5a59..4750d7a08 100644 --- a/builder/amazon/common/step_create_tags.go +++ b/builder/amazon/common/step_create_tags.go @@ -34,8 +34,13 @@ func (s *StepCreateTags) Run(state multistep.StateBag) multistep.StepAction { // Declare list of resources to tag resourceIds := []*string{&ami} + regionconn := ec2.New(&aws.Config{ + Credentials: ec2conn.Config.Credentials, + Region: region, + }) + // Retrieve image list for given AMI - imageResp, err := ec2conn.DescribeImages(&ec2.DescribeImagesInput{ + imageResp, err := regionconn.DescribeImages(&ec2.DescribeImagesInput{ ImageIDs: resourceIds, }) @@ -63,11 +68,6 @@ func (s *StepCreateTags) Run(state multistep.StateBag) multistep.StepAction { } } - regionconn := ec2.New(&aws.Config{ - Credentials: ec2conn.Config.Credentials, - Region: region, - }) - _, err = regionconn.CreateTags(&ec2.CreateTagsInput{ Resources: resourceIds, Tags: ec2Tags,