provider/aws: Wait for `aws_route_53_record` to be in-sync after a

delete

Fixes #6679

When we change the type of a record, it forces a new resource. We never
waited for the recordset to be in-sync after a deletion.

```
% 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/03 17:55:03 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 (85.54s)
=== RUN   TestAccAWSRoute53Record_basic_fqdn
--- PASS: TestAccAWSRoute53Record_basic_fqdn (101.75s)
=== RUN   TestAccAWSRoute53Record_txtSupport
--- PASS: TestAccAWSRoute53Record_txtSupport (84.01s)
=== RUN   TestAccAWSRoute53Record_spfSupport
--- PASS: TestAccAWSRoute53Record_spfSupport (85.08s)
=== RUN   TestAccAWSRoute53Record_generatesSuffix
--- PASS: TestAccAWSRoute53Record_generatesSuffix (97.12s)
=== RUN   TestAccAWSRoute53Record_wildcard
--- PASS: TestAccAWSRoute53Record_wildcard (141.08s)
=== RUN   TestAccAWSRoute53Record_failover
--- PASS: TestAccAWSRoute53Record_failover (91.25s)
=== RUN   TestAccAWSRoute53Record_weighted_basic
--- PASS: TestAccAWSRoute53Record_weighted_basic (89.01s)
=== RUN   TestAccAWSRoute53Record_alias
--- PASS: TestAccAWSRoute53Record_alias (88.91s)
=== RUN   TestAccAWSRoute53Record_s3_alias
--- PASS: TestAccAWSRoute53Record_s3_alias (103.10s)
=== RUN   TestAccAWSRoute53Record_weighted_alias
--- PASS: TestAccAWSRoute53Record_weighted_alias (174.71s)
=== RUN   TestAccAWSRoute53Record_geolocation_basic
--- PASS: TestAccAWSRoute53Record_geolocation_basic (89.50s)
=== RUN   TestAccAWSRoute53Record_latency_basic
--- PASS: TestAccAWSRoute53Record_latency_basic (89.12s)
=== RUN   TestAccAWSRoute53Record_TypeChange
--- PASS: TestAccAWSRoute53Record_TypeChange (138.09s)
=== RUN   TestAccAWSRoute53Record_empty
--- PASS: TestAccAWSRoute53Record_empty (88.51s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws
1684.774s
```
This commit is contained in:
stack72 2016-09-03 18:14:50 +03:00
parent 10bf48a35a
commit 0c80b4d172
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
2 changed files with 41 additions and 1 deletions

View File

@ -528,7 +528,18 @@ func resourceAwsRoute53RecordDelete(d *schema.ResourceData, meta interface{}) er
ChangeBatch: changeBatch,
}
_, err = deleteRoute53RecordSet(conn, req)
respRaw, err := deleteRoute53RecordSet(conn, req)
if err != nil {
return errwrap.Wrapf("[ERR]: Error building changeset: {{err}}", err)
}
changeInfo := respRaw.(*route53.ChangeResourceRecordSetsOutput).ChangeInfo
err = waitForRoute53RecordSetToSync(conn, cleanChangeID(*changeInfo.Id))
if err != nil {
return err
}
return err
}

View File

@ -454,6 +454,35 @@ resource "aws_route53_record" "default" {
records = ["127.0.0.1", "127.0.0.27"]
}
`
const testAccRoute53RecordConfigCNAMERecord = `
resource "aws_route53_zone" "main" {
name = "notexample.com"
}
resource "aws_route53_record" "default" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "host123.domain"
type = "CNAME"
ttl = "30"
records = ["1.2.3.4"]
}
`
const testAccRoute53RecordConfigCNAMERecordUpdateToCNAME = `
resource "aws_route53_zone" "main" {
name = "notexample.com"
}
resource "aws_route53_record" "default" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "host123.domain"
type = "A"
ttl = "30"
records = ["1.2.3.4"]
}
`
const testAccRoute53RecordConfig_fqdn = `
resource "aws_route53_zone" "main" {
name = "notexample.com"