From a5c476c6fef5f17a98ced38834c2df110f45eee0 Mon Sep 17 00:00:00 2001 From: Henry Huang Date: Thu, 4 Jun 2015 06:16:44 -0400 Subject: [PATCH] check the region before do the ami copy to fix [GH-2123] --- builder/amazon/common/step_ami_region_copy.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builder/amazon/common/step_ami_region_copy.go b/builder/amazon/common/step_ami_region_copy.go index 591dcbdf0..70af06aa5 100644 --- a/builder/amazon/common/step_ami_region_copy.go +++ b/builder/amazon/common/step_ami_region_copy.go @@ -32,6 +32,12 @@ func (s *StepAMIRegionCopy) Run(state multistep.StateBag) multistep.StepAction { var wg sync.WaitGroup errs := new(packer.MultiError) for _, region := range s.Regions { + + if region == ec2conn.Config.Region { + ui.Message(fmt.Sprintf("Avoid copying AMI (%s) to %s", ec2conn.Config.Region, region)) + continue + } + wg.Add(1) ui.Message(fmt.Sprintf("Copying to: %s", region))