Merge pull request #665 from gosuri/master
Fix for #664, crashed due to ig.Attachements being 0
This commit is contained in:
commit
6098809ec5
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue