Merge pull request #665 from gosuri/master

Fix for #664, crashed due to ig.Attachements being 0
This commit is contained in:
Armon Dadgar 2014-12-14 18:15:27 -08:00
commit 6098809ec5
1 changed files with 6 additions and 1 deletions

View File

@ -59,7 +59,12 @@ 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 {
// Gateway exists but not attached to the VPC
d.Set("vpc_id", "")
} else {
d.Set("vpc_id", ig.Attachments[0].VpcId)
}
return nil
}