From 014bde64c4e36d0950e083e496f2181a070c84ad Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 7 Oct 2014 21:55:40 -0700 Subject: [PATCH] providers/aws: not an error if route53 record is already destroy [GH-342] --- CHANGELOG.md | 1 + builtin/providers/aws/resource_aws_route53_record.go | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a5f4c860..dc80b5ae1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ BUG FIXES: * providers/aws: not an error when RDS instance is deleted manually. [GH-307] * providers/aws: Retry deleting subnet for some time while AWS eventually destroys dependencies. [GH-357] + * providers/aws: More robust destroy for route53 records. [GH-342] ## 0.2.2 (September 9, 2014) diff --git a/builtin/providers/aws/resource_aws_route53_record.go b/builtin/providers/aws/resource_aws_route53_record.go index 60ff8df2a..31ec0d91f 100644 --- a/builtin/providers/aws/resource_aws_route53_record.go +++ b/builtin/providers/aws/resource_aws_route53_record.go @@ -165,13 +165,18 @@ func resource_aws_r53_record_destroy( if strings.Contains(err.Error(), "PriorRequestNotComplete") { // There is some pending operation, so just retry // in a bit. - return nil, "rejected", nil + return 42, "rejected", nil } - return nil, "failure", err + if strings.Contains(err.Error(), "InvalidChangeBatch") { + // This means that the record is already gone. + return 42, "accepted", nil + } + + return 42, "failure", err } - return nil, "accepted", nil + return 42, "accepted", nil }, } if _, err := wait.WaitForState(); err != nil {