From c0e69a9da0e590f844cc0d188745959b9fd184eb Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 2 May 2019 13:28:43 -0700 Subject: [PATCH] if encrypt_boot is explicitly set to false, don't copy. Also, make sure we don't cause a wait group block when we aren't performing a copy. --- builder/amazon/common/step_ami_region_copy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builder/amazon/common/step_ami_region_copy.go b/builder/amazon/common/step_ami_region_copy.go index f88a5fb4a..02e00c8ea 100644 --- a/builder/amazon/common/step_ami_region_copy.go +++ b/builder/amazon/common/step_ami_region_copy.go @@ -51,9 +51,11 @@ func (s *StepAMIRegionCopy) Run(ctx context.Context, state multistep.StateBag) m wg.Add(len(s.Regions)) for _, region := range s.Regions { - if region == *ec2conn.Config.Region && s.EncryptBootVolume == nil { + if region == *ec2conn.Config.Region && + (s.EncryptBootVolume == nil || *s.EncryptBootVolume == false) { ui.Message(fmt.Sprintf( "Avoiding copying AMI to duplicate region %s", region)) + wg.Done() continue }