@@ -55,6 +55,51 @@ func TestAccTencentCloudDnspodRecordResource_basic(t *testing.T) {
5555 })
5656}
5757
58+ func TestAccTencentCloudDnspodRecordResource_MX (t * testing.T ) {
59+ t .Parallel ()
60+ resource .Test (t , resource.TestCase {
61+ PreCheck : func () { testAccPreCheckCommon (t , ACCOUNT_TYPE_PREPAY ) },
62+ Providers : testAccProviders ,
63+ CheckDestroy : testAccCheckDnspodRecordDestroy ,
64+ Steps : []resource.TestStep {
65+ {
66+ Config : testAccTencentCloudDnspodRecordMx ,
67+ Check : resource .ComposeTestCheckFunc (
68+ testAccCheckDnspodRecordExists ("tencentcloud_dnspod_record.demo" ),
69+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "domain" , "iac-tf.cloud" ),
70+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "record_type" , "MX" ),
71+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "record_line" , "默认" ),
72+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "value" , "1.2.3.9." ),
73+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "sub_domain" , "@" ),
74+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "mx" , "10" ),
75+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "ttl" , "86400" ),
76+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "status" , "ENABLE" ),
77+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "remark" , "terraform-test" ),
78+ ),
79+ },
80+ {
81+ Config : testAccTencentCloudDnspodRecordMxUpdate ,
82+ Check : resource .ComposeTestCheckFunc (
83+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "domain" , "iac-tf.cloud" ),
84+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "record_type" , "MX" ),
85+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "record_line" , "默认" ),
86+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "value" , "1.2.3.19." ),
87+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "sub_domain" , "@" ),
88+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "mx" , "10" ),
89+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "ttl" , "86400" ),
90+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "status" , "ENABLE" ),
91+ resource .TestCheckResourceAttr ("tencentcloud_dnspod_record.demo" , "remark" , "terraform-test" ),
92+ ),
93+ },
94+ {
95+ ResourceName : "tencentcloud_dnspod_record.demo" ,
96+ ImportState : true ,
97+ ImportStateVerify : true ,
98+ },
99+ },
100+ })
101+ }
102+
58103func testAccCheckDnspodRecordExists (n string ) resource.TestCheckFunc {
59104 return func (s * terraform.State ) error {
60105 rs , ok := s .RootModule ().Resources [n ]
@@ -152,3 +197,30 @@ const testAccTencentCloudDnspodRecordRemarkUp = `
152197 remark="terraform-test1"
153198 }
154199`
200+
201+ const testAccTencentCloudDnspodRecordMx = `
202+ resource "tencentcloud_dnspod_record" "demo" {
203+ domain = "iac-tf.cloud"
204+ record_type = "MX"
205+ record_line = "默认"
206+ value = "1.2.3.9."
207+ sub_domain = "@"
208+ mx = 10
209+ ttl = 86400
210+ status = "ENABLE"
211+ remark = "terraform-test"
212+ }
213+ `
214+ const testAccTencentCloudDnspodRecordMxUpdate = `
215+ resource "tencentcloud_dnspod_record" "demo" {
216+ domain = "iac-tf.cloud"
217+ record_type = "MX"
218+ record_line = "默认"
219+ value = "1.2.3.19."
220+ sub_domain = "@"
221+ mx = 10
222+ ttl = 86400
223+ status = "ENABLE"
224+ remark = "terraform-test"
225+ }
226+ `
0 commit comments