|
|
|
|
@ -43,7 +43,7 @@ type StepRunSpotInstance struct {
|
|
|
|
|
spotRequest *ec2.SpotInstanceRequest
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *StepRunSpotInstance) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
|
|
|
|
func (s *StepRunSpotInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
|
|
|
|
ec2conn := state.Get("ec2").(*ec2.EC2)
|
|
|
|
|
var keyName string
|
|
|
|
|
if name, ok := state.GetOk("keyPair"); ok {
|
|
|
|
|
@ -235,7 +235,7 @@ func (s *StepRunSpotInstance) Run(_ context.Context, state multistep.StateBag) m
|
|
|
|
|
describeInstance := &ec2.DescribeInstancesInput{
|
|
|
|
|
InstanceIds: []*string{aws.String(instanceId)},
|
|
|
|
|
}
|
|
|
|
|
if err := ec2conn.WaitUntilInstanceRunning(describeInstance); err != nil {
|
|
|
|
|
if err := ec2conn.WaitUntilInstanceRunningWithContext(ctx, describeInstance); err != nil {
|
|
|
|
|
err := fmt.Errorf("Error waiting for instance (%s) to become ready: %s", instanceId, err)
|
|
|
|
|
state.Put("error", err)
|
|
|
|
|
ui.Error(err.Error())
|
|
|
|
|
|