From 81422123e83167a3b264b3344ab52d33b9e47624 Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Mon, 4 May 2015 15:34:39 -0500 Subject: [PATCH] provider/aws: Add a regression check for Route 53 records --- .../aws/resource_aws_route53_record_test.go | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/builtin/providers/aws/resource_aws_route53_record_test.go b/builtin/providers/aws/resource_aws_route53_record_test.go index 7650fd504..6fb20b886 100644 --- a/builtin/providers/aws/resource_aws_route53_record_test.go +++ b/builtin/providers/aws/resource_aws_route53_record_test.go @@ -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"] +} +`