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:
commit
85c8595c89
|
@ -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) {
|
func TestAccAWSRoute53Record_generatesSuffix(t *testing.T) {
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
@ -400,6 +417,19 @@ resource "aws_route53_record" "default" {
|
||||||
records = ["lalalala"]
|
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 = `
|
const testAccRoute53FailoverCNAMERecord = `
|
||||||
resource "aws_route53_zone" "main" {
|
resource "aws_route53_zone" "main" {
|
||||||
|
|
|
@ -500,7 +500,7 @@ func expandResourceRecords(recs []interface{}, typeStr string) []*route53.Resour
|
||||||
for _, r := range recs {
|
for _, r := range recs {
|
||||||
s := r.(string)
|
s := r.(string)
|
||||||
switch typeStr {
|
switch typeStr {
|
||||||
case "TXT":
|
case "TXT", "SPF":
|
||||||
str := fmt.Sprintf("\"%s\"", s)
|
str := fmt.Sprintf("\"%s\"", s)
|
||||||
records = append(records, &route53.ResourceRecord{Value: aws.String(str)})
|
records = append(records, &route53.ResourceRecord{Value: aws.String(str)})
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue