Merge pull request #889 from bitglue/deleted_subnet

provider/aws: Fix error when refreshing on a deleted AWS subnet
This commit is contained in:
Mitchell Hashimoto 2015-02-17 09:30:48 -08:00
commit aad83447d2
1 changed files with 5 additions and 0 deletions

View File

@ -95,6 +95,11 @@ func resourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error {
resp, err := ec2conn.DescribeSubnets([]string{d.Id()}, ec2.NewFilter())
if err != nil {
if ec2err, ok := err.(*ec2.Error); ok && ec2err.Code == "InvalidSubnetID.NotFound" {
// Update state to indicate the subnet no longer exists.
d.SetId("")
return nil
}
return err
}
if resp == nil {