@@ -876,6 +876,54 @@ func TestAccDomainRecord_CNAME(t *testing.T) {
876876 })
877877}
878878
879+ func TestAccDomainRecord_NameDiffSuppress (t * testing.T ) {
880+ tt := acctest .NewTestTools (t )
881+ defer tt .Cleanup ()
882+
883+ testDNSZone := "test-name-diff." + acctest .TestDomain
884+ logging .L .Debugf ("TestAccDomainRecord_NameDiffSuppress: test dns zone: %s" , testDNSZone )
885+
886+ resource .ParallelTest (t , resource.TestCase {
887+ PreCheck : func () { acctest .PreCheck (t ) },
888+ ProtoV6ProviderFactories : tt .ProviderFactories ,
889+ CheckDestroy : testAccCheckDomainRecordDestroy (tt ),
890+ Steps : []resource.TestStep {
891+ {
892+ Config : fmt .Sprintf (`
893+ resource "scaleway_domain_record" "dmarc" {
894+ dns_zone = "%s"
895+ name = "_dmarc"
896+ type = "TXT"
897+ data = "v=DMARC1; p=none"
898+ }
899+ ` , testDNSZone ),
900+ Check : resource .ComposeTestCheckFunc (
901+ testAccCheckDomainRecordExists (tt , "scaleway_domain_record.dmarc" ),
902+ resource .TestCheckResourceAttr ("scaleway_domain_record.dmarc" , "name" , "_dmarc" ),
903+ resource .TestCheckResourceAttr ("scaleway_domain_record.dmarc" , "type" , "TXT" ),
904+ resource .TestCheckResourceAttr ("scaleway_domain_record.dmarc" , "data" , "v=DMARC1; p=none" ),
905+ ),
906+ },
907+ {
908+ // Use FQDN format - should not cause replacement
909+ Config : fmt .Sprintf (`
910+ resource "scaleway_domain_record" "dmarc" {
911+ dns_zone = "%s"
912+ name = "_dmarc.%s."
913+ type = "TXT"
914+ data = "v=DMARC1; p=none"
915+ }
916+ ` , testDNSZone , testDNSZone ),
917+ Check : resource .ComposeTestCheckFunc (
918+ testAccCheckDomainRecordExists (tt , "scaleway_domain_record.dmarc" ),
919+ resource .TestCheckResourceAttr ("scaleway_domain_record.dmarc" , "name" , "_dmarc" ),
920+ resource .TestCheckResourceAttr ("scaleway_domain_record.dmarc" , "type" , "TXT" ),
921+ ),
922+ },
923+ },
924+ })
925+ }
926+
879927func testAccCheckDomainRecordDestroy (tt * acctest.TestTools ) resource.TestCheckFunc {
880928 return func (state * terraform.State ) error {
881929 for _ , rs := range state .RootModule ().Resources {
@@ -910,3 +958,5 @@ func testAccCheckDomainRecordDestroy(tt *acctest.TestTools) resource.TestCheckFu
910958 return nil
911959 }
912960}
961+
962+
0 commit comments