Merge pull request #1795 from hashicorp/b-aws-route53-record-type-check

provider/aws: Add a regression check for Route 53 records
This commit is contained in:
Clint 2015-05-04 17:19:53 -05:00
commit 98d34a3266
1 changed files with 52 additions and 0 deletions

View File

@ -190,6 +190,30 @@ func TestAccRoute53Record_weighted_alias(t *testing.T) {
})
}
func TestAccRoute53Record_TypeChange(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckRoute53RecordDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccRoute53RecordTypeChangePre,
Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53RecordExists("aws_route53_record.sample"),
),
},
// Cause a change, which will trigger a refresh
resource.TestStep{
Config: testAccRoute53RecordTypeChangePost,
Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53RecordExists("aws_route53_record.sample"),
),
},
},
})
}
func testAccCheckRoute53RecordDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*AWSClient).r53conn
for _, rs := range s.RootModule().Resources {
@ -544,3 +568,31 @@ resource "aws_route53_record" "r53_weighted_alias_dev" {
}
}
`
const testAccRoute53RecordTypeChangePre = `
resource "aws_route53_zone" "main" {
name = "notexample.com"
}
resource "aws_route53_record" "sample" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "sample"
type = "CNAME"
ttl = "30"
records = ["www.terraform.io"]
}
`
const testAccRoute53RecordTypeChangePost = `
resource "aws_route53_zone" "main" {
name = "notexample.com"
}
resource "aws_route53_record" "sample" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "sample"
type = "A"
ttl = "30"
records = ["127.0.0.1", "8.8.8.8"]
}
`