Merge pull request #6697 from hashicorp/fix_6696
spot instance creation, only set blockDurationMinutes when > 0
This commit is contained in:
commit
70b0380558
|
@ -186,12 +186,15 @@ func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag)
|
|||
if s.Comm.SSHKeyPairName != "" {
|
||||
runOpts.KeyName = &s.Comm.SSHKeyPairName
|
||||
}
|
||||
spotInstanceInput := &ec2.RequestSpotInstancesInput{
|
||||
LaunchSpecification: runOpts,
|
||||
SpotPrice: &spotPrice,
|
||||
}
|
||||
if s.BlockDurationMinutes != 0 {
|
||||
spotInstanceInput.BlockDurationMinutes = &s.BlockDurationMinutes
|
||||
}
|
||||
|
||||
runSpotResp, err := ec2conn.RequestSpotInstances(&ec2.RequestSpotInstancesInput{
|
||||
BlockDurationMinutes: &s.BlockDurationMinutes,
|
||||
LaunchSpecification: runOpts,
|
||||
SpotPrice: &spotPrice,
|
||||
})
|
||||
runSpotResp, err := ec2conn.RequestSpotInstances(spotInstanceInput)
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Error launching source spot instance: %s", err)
|
||||
state.Put("error", err)
|
||||
|
|
Loading…
Reference in New Issue