Merge pull request #8113 from hashicorp/fix_8108

fix amazon import post-processor encryption
This commit is contained in:
Adrien Delorme 2019-09-17 11:06:11 +02:00 committed by GitHub
commit 1b046647ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -273,11 +273,19 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact
ui.Message(fmt.Sprintf("Starting rename of AMI (%s)", createdami))
resp, err := ec2conn.CopyImage(&ec2.CopyImageInput{
copyInput := &ec2.CopyImageInput{
Name: &p.config.Name,
SourceImageId: &createdami,
SourceRegion: config.Region,
})
}
if p.config.Encrypt {
copyInput.Encrypted = aws.Bool(p.config.Encrypt)
if p.config.KMSKey != "" {
copyInput.KmsKeyId = &p.config.KMSKey
}
}
resp, err := ec2conn.CopyImage(copyInput)
if err != nil {
return nil, false, false, fmt.Errorf("Error Copying AMI (%s): %s", createdami, err)