Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final retries for elasticache #9013

Merged
merged 5 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions aws/resource_aws_elasticache_parameter_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ func resourceAwsElasticacheParameterGroupUpdate(d *schema.ResourceData, meta int
func resourceAwsElasticacheParameterGroupDelete(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).elasticacheconn

return resource.Retry(3*time.Minute, func() *resource.RetryError {
deleteOpts := elasticache.DeleteCacheParameterGroupInput{
CacheParameterGroupName: aws.String(d.Id()),
}
deleteOpts := elasticache.DeleteCacheParameterGroupInput{
CacheParameterGroupName: aws.String(d.Id()),
}
err := resource.Retry(3*time.Minute, func() *resource.RetryError {
_, err := conn.DeleteCacheParameterGroup(&deleteOpts)
if err != nil {
awsErr, ok := err.(awserr.Error)
Expand All @@ -335,6 +335,18 @@ func resourceAwsElasticacheParameterGroupDelete(d *schema.ResourceData, meta int
}
return nil
})
if isResourceTimeoutError(err) {
_, err = conn.DeleteCacheParameterGroup(&deleteOpts)
}
if isAWSErr(err, elasticache.ErrCodeCacheParameterGroupNotFoundFault, "") {
return nil
}

if err != nil {
return fmt.Errorf("error deleting Elasticache Parameter Group (%s): %s", d.Id(), err)
}

return nil
}

func resourceAwsElasticacheParameterHash(v interface{}) int {
Expand Down
10 changes: 9 additions & 1 deletion aws/resource_aws_elasticache_replication_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,16 @@ func deleteElasticacheReplicationGroup(replicationGroupID string, conn *elastica
}
return nil
})
if isResourceTimeoutError(err) {
_, err = conn.DeleteReplicationGroup(input)
}
ryndaniels marked this conversation as resolved.
Show resolved Hide resolved

if isAWSErr(err, elasticache.ErrCodeReplicationGroupNotFoundFault, "") {
return nil
}

if err != nil {
return err
return fmt.Errorf("error deleting Elasticache Replication Group: %s", err)
}

log.Printf("[DEBUG] Waiting for deletion: %s", replicationGroupID)
Expand Down
17 changes: 16 additions & 1 deletion aws/resource_aws_elasticache_subnet_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func resourceAwsElasticacheSubnetGroupDelete(d *schema.ResourceData, meta interf

log.Printf("[DEBUG] Cache subnet group delete: %s", d.Id())

return resource.Retry(5*time.Minute, func() *resource.RetryError {
err := resource.Retry(5*time.Minute, func() *resource.RetryError {
_, err := conn.DeleteCacheSubnetGroup(&elasticache.DeleteCacheSubnetGroupInput{
CacheSubnetGroupName: aws.String(d.Id()),
})
Expand All @@ -173,4 +173,19 @@ func resourceAwsElasticacheSubnetGroupDelete(d *schema.ResourceData, meta interf
}
return nil
})
if isResourceTimeoutError(err) {
_, err = conn.DeleteCacheSubnetGroup(&elasticache.DeleteCacheSubnetGroupInput{
CacheSubnetGroupName: aws.String(d.Id()),
})
}

if isAWSErr(err, elasticache.ErrCodeCacheSubnetGroupNotFoundFault, "") {
return nil
}

if err != nil {
return fmt.Errorf("error deleting Elasticache Subnet Group (%s): %s", d.Id(), err)
}

return nil
}