Skip to content

Commit

Permalink
ElastiCache cluster read tolerates removed cluster.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stack72 authored and apparentlymart committed Nov 5, 2015
1 parent bf11be8 commit 9cee18b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builtin/providers/aws/resource_aws_elasticache_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,12 @@ func resourceAwsElasticacheClusterRead(d *schema.ResourceData, meta interface{})

res, err := conn.DescribeCacheClusters(req)
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
}

Expand Down

0 comments on commit 9cee18b

Please sign in to comment.