From a367f3550f7a6618dbb4ec616af1a96699b2f3aa Mon Sep 17 00:00:00 2001 From: stack72 Date: Mon, 26 Sep 2016 11:27:56 +0100 Subject: [PATCH] provider/aws: guard against aws_route53_record delete panic Fixes #9025 We were assuming there would always be a changeInfo record and then dereferencing the ID. This wasn't always the case (As noted in #9025) where it was a delete rather than a delete / create action ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSRoute53Record_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/09/26 11:26:43 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSRoute53Record_ -timeout 120m === RUN TestAccAWSRoute53Record_basic --- PASS: TestAccAWSRoute53Record_basic (114.99s) === RUN TestAccAWSRoute53Record_basic_fqdn --- PASS: TestAccAWSRoute53Record_basic_fqdn (126.64s) === RUN TestAccAWSRoute53Record_txtSupport --- PASS: TestAccAWSRoute53Record_txtSupport (113.25s) === RUN TestAccAWSRoute53Record_spfSupport --- PASS: TestAccAWSRoute53Record_spfSupport (112.89s) === RUN TestAccAWSRoute53Record_generatesSuffix --- PASS: TestAccAWSRoute53Record_generatesSuffix (113.29s) === RUN TestAccAWSRoute53Record_wildcard --- PASS: TestAccAWSRoute53Record_wildcard (163.05s) === RUN TestAccAWSRoute53Record_failover --- PASS: TestAccAWSRoute53Record_failover (121.15s) === RUN TestAccAWSRoute53Record_weighted_basic --- PASS: TestAccAWSRoute53Record_weighted_basic (117.06s) === RUN TestAccAWSRoute53Record_alias --- PASS: TestAccAWSRoute53Record_alias (116.97s) === RUN TestAccAWSRoute53Record_s3_alias --- PASS: TestAccAWSRoute53Record_s3_alias (138.79s) === RUN TestAccAWSRoute53Record_weighted_alias --- PASS: TestAccAWSRoute53Record_weighted_alias (241.48s) === RUN TestAccAWSRoute53Record_geolocation_basic --- PASS: TestAccAWSRoute53Record_geolocation_basic (132.51s) === RUN TestAccAWSRoute53Record_latency_basic --- PASS: TestAccAWSRoute53Record_latency_basic (121.29s) === RUN TestAccAWSRoute53Record_TypeChange --- PASS: TestAccAWSRoute53Record_TypeChange (189.31s) === RUN TestAccAWSRoute53Record_empty --- PASS: TestAccAWSRoute53Record_empty (127.31s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 2050.012s ``` --- builtin/providers/aws/resource_aws_route53_record.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builtin/providers/aws/resource_aws_route53_record.go b/builtin/providers/aws/resource_aws_route53_record.go index 8a5b5c92d9..1b6a54ea23 100644 --- a/builtin/providers/aws/resource_aws_route53_record.go +++ b/builtin/providers/aws/resource_aws_route53_record.go @@ -534,6 +534,10 @@ func resourceAwsRoute53RecordDelete(d *schema.ResourceData, meta interface{}) er } changeInfo := respRaw.(*route53.ChangeResourceRecordSetsOutput).ChangeInfo + if changeInfo == nil { + log.Printf("[INFO] No ChangeInfo Found. Waiting for Sync not required") + return nil + } err = waitForRoute53RecordSetToSync(conn, cleanChangeID(*changeInfo.Id)) if err != nil {