Merge pull request #4108 from stack72/f-aws-route53-spf-record

provider/aws: Normalization of SPF records to prevent reporting changes
This commit is contained in:
James Nugent 2015-11-30 13:15:32 +00:00
commit 85c8595c89
2 changed files with 31 additions and 1 deletions

View File

@ -82,6 +82,23 @@ func TestAccAWSRoute53Record_txtSupport(t *testing.T) {
})
}
func TestAccAWSRoute53Record_spfSupport(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckRoute53RecordDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccRoute53RecordConfigSPF,
Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53RecordExists("aws_route53_record.default"),
resource.TestCheckResourceAttr(
"aws_route53_record.default", "records.2930149397", "include:notexample.com"),
),
},
},
})
}
func TestAccAWSRoute53Record_generatesSuffix(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -400,6 +417,19 @@ resource "aws_route53_record" "default" {
records = ["lalalala"]
}
`
const testAccRoute53RecordConfigSPF = `
resource "aws_route53_zone" "main" {
name = "notexample.com"
}
resource "aws_route53_record" "default" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "test"
type = "SPF"
ttl = "30"
records = ["include:notexample.com"]
}
`
const testAccRoute53FailoverCNAMERecord = `
resource "aws_route53_zone" "main" {

View File

@ -500,7 +500,7 @@ func expandResourceRecords(recs []interface{}, typeStr string) []*route53.Resour
for _, r := range recs {
s := r.(string)
switch typeStr {
case "TXT":
case "TXT", "SPF":
str := fmt.Sprintf("\"%s\"", s)
records = append(records, &route53.ResourceRecord{Value: aws.String(str)})
default: