Skip to content

Commit

Permalink
Merge pull request hashicorp#3868 from genevieve/master
Browse files Browse the repository at this point in the history
Retry acm certificate delete when in use exception.
  • Loading branch information
bflad authored Mar 22, 2018
2 parents 89876a4 + cf53d3a commit 2e7b47a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion aws/resource_aws_acm_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,23 @@ func convertValidationOptions(certificate *acm.CertificateDetail) ([]map[string]
func resourceAwsAcmCertificateDelete(d *schema.ResourceData, meta interface{}) error {
acmconn := meta.(*AWSClient).acmconn

log.Printf("[INFO] Deleting ACM Certificate: %s", d.Id())

params := &acm.DeleteCertificateInput{
CertificateArn: aws.String(d.Id()),
}

_, err := acmconn.DeleteCertificate(params)
err := resource.Retry(10*time.Minute, func() *resource.RetryError {
_, err := acmconn.DeleteCertificate(params)
if err != nil {
if isAWSErr(err, acm.ErrCodeResourceInUseException, "") {
log.Printf("[WARN] Conflict deleting certificate in use: %s, retrying", err.Error())
return resource.RetryableError(err)
}
return resource.NonRetryableError(err)
}
return nil
})

if err != nil && !isAWSErr(err, acm.ErrCodeResourceNotFoundException, "") {
return fmt.Errorf("Error deleting certificate: %s", err)
Expand Down

0 comments on commit 2e7b47a

Please sign in to comment.