Merge pull request #889 from bitglue/deleted_subnet
provider/aws: Fix error when refreshing on a deleted AWS subnet
This commit is contained in:
commit
aad83447d2
|
@ -95,6 +95,11 @@ func resourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
resp, err := ec2conn.DescribeSubnets([]string{d.Id()}, ec2.NewFilter())
|
resp, err := ec2conn.DescribeSubnets([]string{d.Id()}, ec2.NewFilter())
|
||||||
|
|
||||||
if err != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
if resp == nil {
|
if resp == nil {
|
||||||
|
|
Loading…
Reference in New Issue