provider/aws: Check for empty instances in AWS Instance RunInstance response

Fixes #4206
This commit is contained in:
clint shryock 2015-12-08 14:22:51 -06:00
parent fcd8a881df
commit 9fc6c27de1
1 changed files with 3 additions and 0 deletions

View File

@ -370,6 +370,9 @@ func resourceAwsInstanceCreate(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return fmt.Errorf("Error launching source instance: %s", err)
}
if runResp == nil || len(runResp.Instances) == 0 {
return fmt.Errorf("Error launching source instance: no instances returned in response")
}
instance := runResp.Instances[0]
log.Printf("[INFO] Instance ID: %s", *instance.InstanceId)