From b51761ca36e72e8f772e2e179d50b42a8c362a9f Mon Sep 17 00:00:00 2001 From: Marcin Matlaszek Date: Sun, 14 Jun 2015 17:35:50 +0200 Subject: [PATCH] Fix network interface spec when requesting spot. --- builder/amazon/common/step_run_source_instance.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go index 92dafa564..71345ade7 100644 --- a/builder/amazon/common/step_run_source_instance.go +++ b/builder/amazon/common/step_run_source_instance.go @@ -174,11 +174,15 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi ImageID: &s.SourceAMI, InstanceType: &s.InstanceType, UserData: &userData, - SecurityGroupIDs: securityGroupIds, IAMInstanceProfile: &ec2.IAMInstanceProfileSpecification{Name: &s.IamInstanceProfile}, - SubnetID: &s.SubnetId, NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ - &ec2.InstanceNetworkInterfaceSpecification{AssociatePublicIPAddress: &s.AssociatePublicIpAddress}, + &ec2.InstanceNetworkInterfaceSpecification{ + DeviceIndex: aws.Long(0), + AssociatePublicIPAddress: &s.AssociatePublicIpAddress, + SubnetID: &s.SubnetId, + Groups: securityGroupIds, + DeleteOnTermination: aws.Boolean(true), + }, }, Placement: &ec2.SpotPlacement{ AvailabilityZone: &availabilityZone,