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.

This commit is contained in:
Megan Marsh 2019-05-02 13:28:43 -07:00
parent d343852c15
commit c0e69a9da0
1 changed files with 3 additions and 1 deletions

View File

@ -51,9 +51,11 @@ func (s *StepAMIRegionCopy) Run(ctx context.Context, state multistep.StateBag) m
wg.Add(len(s.Regions)) wg.Add(len(s.Regions))
for _, region := range 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( ui.Message(fmt.Sprintf(
"Avoiding copying AMI to duplicate region %s", region)) "Avoiding copying AMI to duplicate region %s", region))
wg.Done()
continue continue
} }