Merge pull request #4221 from hashicorp/b-aws-runinstances-check

provider/aws: Handle empty Instances response from RunInstances
This commit is contained in:
Clint 2015-12-09 09:54:02 -06:00
commit 9044807152
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)