Fix for #664, crashed due to ig.Attachements being 0

This commit is contained in:
Greg Osuri 2014-12-13 22:14:23 -08:00
parent 69b2c245dd
commit 3883e47902
1 changed files with 5 additions and 1 deletions

View File

@ -60,7 +60,11 @@ func resourceAwsInternetGatewayRead(d *schema.ResourceData, meta interface{}) er
}
ig := igRaw.(*ec2.InternetGateway)
d.Set("vpc_id", ig.Attachments[0].VpcId)
if len(ig.Attachments) == 0 {
d.SetId("")
} else {
d.Set("vpc_id", ig.Attachments[0].VpcId)
}
return nil
}