From 6af621c37a1bbc475efce9d31347c6d1e7eb9be8 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Mon, 26 Nov 2018 11:32:54 +0100 Subject: [PATCH] aws: StepAMIRegionCopy call waitgroup.add only once --- builder/amazon/common/step_ami_region_copy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/amazon/common/step_ami_region_copy.go b/builder/amazon/common/step_ami_region_copy.go index b8bf9d2d6..3e99f281c 100644 --- a/builder/amazon/common/step_ami_region_copy.go +++ b/builder/amazon/common/step_ami_region_copy.go @@ -37,6 +37,8 @@ func (s *StepAMIRegionCopy) Run(ctx context.Context, state multistep.StateBag) m var wg sync.WaitGroup var regKeyID string errs := new(packer.MultiError) + + wg.Add(len(s.Regions)) for _, region := range s.Regions { if region == *ec2conn.Config.Region { ui.Message(fmt.Sprintf( @@ -44,7 +46,6 @@ func (s *StepAMIRegionCopy) Run(ctx context.Context, state multistep.StateBag) m continue } - wg.Add(1) ui.Message(fmt.Sprintf("Copying to: %s", region)) if s.EncryptBootVolume {