Skip to content

Commit

Permalink
Fix for hashicorp#664, crashed due to ig.Attachements being 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Osuri committed Dec 14, 2014
1 parent 69b2c24 commit 3883e47
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion builtin/providers/aws/resource_aws_internet_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3883e47

Please sign in to comment.