From 4d003aa5a30b15068440c766c5d6daff3eeae78d Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Fri, 26 Jun 2015 10:43:13 -0500 Subject: [PATCH] builder/amazon-instance: Don't specify empty Virtualization Type --- builder/amazon/instance/step_register_ami.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/builder/amazon/instance/step_register_ami.go b/builder/amazon/instance/step_register_ami.go index c3150449d..f97c5df0e 100644 --- a/builder/amazon/instance/step_register_ami.go +++ b/builder/amazon/instance/step_register_ami.go @@ -3,6 +3,7 @@ package instance import ( "fmt" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" "github.com/mitchellh/multistep" awscommon "github.com/mitchellh/packer/builder/amazon/common" @@ -20,15 +21,17 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction { ui.Say("Registering the AMI...") registerOpts := &ec2.RegisterImageInput{ ImageLocation: &manifestPath, - Name: &config.AMIName, + Name: aws.String(config.AMIName), BlockDeviceMappings: config.BlockDevices.BuildAMIDevices(), - VirtualizationType: &config.AMIVirtType, + } + + if config.AMIVirtType != "" { + registerOpts.VirtualizationType = aws.String(config.AMIVirtType) } // Set SriovNetSupport to "simple". See http://goo.gl/icuXh5 if config.AMIEnhancedNetworking { - simple := "simple" - registerOpts.SRIOVNetSupport = &simple + registerOpts.SRIOVNetSupport = aws.String("simple") } registerResp, err := ec2conn.RegisterImage(registerOpts)