provider/aws: Fix the Destroy func in the Route53 record tests

The test didn't expand the record name - therefore, when the name was
empty, it wasn't setting it to the domain name (like the normal resource
does!) This was causing an error
This commit is contained in:
stack72 2016-07-18 13:24:14 +01:00
parent aabb200f2d
commit 8a72bfa5a9
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
1 changed files with 5 additions and 2 deletions

View File

@ -368,9 +368,11 @@ func testAccCheckRoute53RecordDestroy(s *terraform.State) error {
name := parts[1] name := parts[1]
rType := parts[2] rType := parts[2]
en := expandRecordName(name, "notexample.com")
lopts := &route53.ListResourceRecordSetsInput{ lopts := &route53.ListResourceRecordSetsInput{
HostedZoneId: aws.String(cleanZoneID(zone)), HostedZoneId: aws.String(cleanZoneID(zone)),
StartRecordName: aws.String(name), StartRecordName: aws.String(en),
StartRecordType: aws.String(rType), StartRecordType: aws.String(rType),
} }
@ -427,6 +429,7 @@ func testAccCheckRoute53RecordExists(n string) resource.TestCheckFunc {
if len(resp.ResourceRecordSets) == 0 { if len(resp.ResourceRecordSets) == 0 {
return fmt.Errorf("Record does not exist") return fmt.Errorf("Record does not exist")
} }
// rec := resp.ResourceRecordSets[0] // rec := resp.ResourceRecordSets[0]
for _, rec := range resp.ResourceRecordSets { for _, rec := range resp.ResourceRecordSets {
recName := cleanRecordName(*rec.Name) recName := cleanRecordName(*rec.Name)
@ -992,7 +995,7 @@ resource "aws_route53_record" "sample" {
const testAccRoute53RecordConfigEmptyName = ` const testAccRoute53RecordConfigEmptyName = `
resource "aws_route53_zone" "main" { resource "aws_route53_zone" "main" {
name = "not.example.com" name = "notexample.com"
} }
resource "aws_route53_record" "empty" { resource "aws_route53_record" "empty" {