ElastiCache cluster read tolerates removed cluster.
Previously it would fail if a Terraform-managed ElastiCache cluster were deleted outside of Terraform. Now it marks it as deleted in the state so that Terraform can know it doesn't need to be destroyed, and can potentially recreate it if asked.
This commit is contained in:
parent
bf11be82c8
commit
9cee18b3de
|
@ -241,6 +241,12 @@ func resourceAwsElasticacheClusterRead(d *schema.ResourceData, meta interface{})
|
||||||
|
|
||||||
res, err := conn.DescribeCacheClusters(req)
|
res, err := conn.DescribeCacheClusters(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if eccErr, ok := err.(awserr.Error); ok && eccErr.Code() == "CacheClusterNotFound" {
|
||||||
|
log.Printf("[WARN] ElastiCache Cluster (%s) not found", d.Id())
|
||||||
|
d.SetId("")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue