Merge branch 'pr-7075'

* pr-7075:
  provider/aws: Log ElasticCache subnet removal
  provider/aws: Update state on `aws_elasticache_subnet_group` not found exception
This commit is contained in:
clint shryock 2016-06-08 13:42:08 -05:00
commit c667b2d8cd
1 changed files with 6 additions and 0 deletions

View File

@ -87,6 +87,12 @@ func resourceAwsElasticacheSubnetGroupRead(d *schema.ResourceData, meta interfac
res, err := conn.DescribeCacheSubnetGroups(req) res, err := conn.DescribeCacheSubnetGroups(req)
if err != nil { if err != nil {
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "CacheSubnetGroupNotFoundFault" {
// Update state to indicate the db subnet no longer exists.
log.Printf("[WARN] Elasticache Subnet Group (%s) not found, removing from state", d.Id())
d.SetId("")
return nil
}
return err return err
} }
if len(res.CacheSubnetGroups) == 0 { if len(res.CacheSubnetGroups) == 0 {