Merge branch 'b-fix-route53-txt-records'
* b-fix-route53-txt-records: provider/aws: Fix issue with Route53 and TXT records provider/aws: Add test for TXT route53 record
This commit is contained in:
commit
a8c80a447e
|
@ -264,8 +264,15 @@ func resourceAwsRoute53RecordBuildSet(d *schema.ResourceData) (*route53.Resource
|
||||||
recs := d.Get("records").(*schema.Set).List()
|
recs := d.Get("records").(*schema.Set).List()
|
||||||
records := make([]route53.ResourceRecord, 0, len(recs))
|
records := make([]route53.ResourceRecord, 0, len(recs))
|
||||||
|
|
||||||
|
typeStr := d.Get("type").(string)
|
||||||
for _, r := range recs {
|
for _, r := range recs {
|
||||||
records = append(records, route53.ResourceRecord{Value: aws.String(r.(string))})
|
switch typeStr {
|
||||||
|
case "TXT":
|
||||||
|
str := fmt.Sprintf("\"%s\"", r.(string))
|
||||||
|
records = append(records, route53.ResourceRecord{Value: aws.String(str)})
|
||||||
|
default:
|
||||||
|
records = append(records, route53.ResourceRecord{Value: aws.String(r.(string))})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rec := &route53.ResourceRecordSet{
|
rec := &route53.ResourceRecordSet{
|
||||||
|
|
|
@ -45,6 +45,22 @@ func TestAccRoute53Record(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAccRoute53Record_txtSupport(t *testing.T) {
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckRoute53RecordDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccRoute53RecordConfigTXT,
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
testAccCheckRoute53RecordExists("aws_route53_record.default"),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestAccRoute53Record_generatesSuffix(t *testing.T) {
|
func TestAccRoute53Record_generatesSuffix(t *testing.T) {
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
@ -230,3 +246,16 @@ resource "aws_route53_record" "wildcard" {
|
||||||
records = ["127.0.0.1"]
|
records = ["127.0.0.1"]
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
const testAccRoute53RecordConfigTXT = `
|
||||||
|
resource "aws_route53_zone" "main" {
|
||||||
|
name = "notexample.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_route53_record" "default" {
|
||||||
|
zone_id = "${aws_route53_zone.main.zone_id}"
|
||||||
|
name = "subdomain"
|
||||||
|
type = "TXT"
|
||||||
|
ttl = "30"
|
||||||
|
records = ["lalalala"]
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
Loading…
Reference in New Issue