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:
stack72 2015-11-05 14:31:55 +00:00 committed by Martin Atkins
parent bf11be82c8
commit 9cee18b3de
1 changed files with 6 additions and 0 deletions

View File

@ -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
} }