@@ -692,6 +692,72 @@ func TestAccDomainRecord_SRVZone(t *testing.T) {
692692 })
693693}
694694
695+ func TestAccDomainRecord_SRVWithDomainDuplication (t * testing.T ) {
696+ tt := acctest .NewTestTools (t )
697+ defer tt .Cleanup ()
698+
699+ testDNSZone := "test-srv-duplication." + acctest .TestDomain
700+ logging .L .Debugf ("TestAccDomainRecord_SRVWithDomainDuplication: test dns zone: %s" , testDNSZone )
701+
702+ name := "_test_srv_bug"
703+ recordType := "SRV"
704+ data := "0 0 1234 foo.example.com"
705+ ttl := 60
706+ priority := 0
707+
708+ resource .ParallelTest (t , resource.TestCase {
709+ PreCheck : func () { acctest .PreCheck (t ) },
710+ ProviderFactories : tt .ProviderFactories ,
711+ CheckDestroy : testAccCheckDomainRecordDestroy (tt ),
712+ Steps : []resource.TestStep {
713+ {
714+ Config : fmt .Sprintf (`
715+ resource "scaleway_domain_record" "srv_test" {
716+ dns_zone = "%[1]s"
717+ name = "%[2]s"
718+ type = "%[3]s"
719+ data = "%[4]s"
720+ priority = %[5]d
721+ ttl = %[6]d
722+ }
723+ ` , testDNSZone , name , recordType , data , priority , ttl ),
724+ Check : resource .ComposeTestCheckFunc (
725+ testAccCheckDomainRecordExists (tt , "scaleway_domain_record.srv_test" ),
726+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "dns_zone" , testDNSZone ),
727+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "name" , name ),
728+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "type" , recordType ),
729+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "data" , "0 0 1234 foo.example.com" ),
730+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "ttl" , strconv .Itoa (ttl )),
731+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "priority" , strconv .Itoa (priority )),
732+ acctest .CheckResourceAttrUUID ("scaleway_domain_record.srv_test" , "id" ),
733+ ),
734+ },
735+ {
736+ Config : fmt .Sprintf (`
737+ resource "scaleway_domain_record" "srv_test" {
738+ dns_zone = "%[1]s"
739+ name = "%[2]s"
740+ type = "%[3]s"
741+ data = "10 0 5678 bar.example.com"
742+ priority = 10
743+ ttl = 300
744+ }
745+ ` , testDNSZone , name , recordType ),
746+ Check : resource .ComposeTestCheckFunc (
747+ testAccCheckDomainRecordExists (tt , "scaleway_domain_record.srv_test" ),
748+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "dns_zone" , testDNSZone ),
749+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "name" , name ),
750+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "type" , recordType ),
751+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "data" , "10 0 5678 bar.example.com" ),
752+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "ttl" , "300" ),
753+ resource .TestCheckResourceAttr ("scaleway_domain_record.srv_test" , "priority" , "10" ),
754+ acctest .CheckResourceAttrUUID ("scaleway_domain_record.srv_test" , "id" ),
755+ ),
756+ },
757+ },
758+ })
759+ }
760+
695761func testAccCheckDomainRecordExists (tt * acctest.TestTools , n string ) resource.TestCheckFunc {
696762 return func (s * terraform.State ) error {
697763 rs , ok := s .RootModule ().Resources [n ]
0 commit comments