Skip to content

Commit 48e1c8c

Browse files
authored
add private dns testcases (#1048)
1 parent f15f19d commit 48e1c8c

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package tencentcloud
2+
3+
import (
4+
"testing"
5+
6+
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
7+
)
8+
9+
func TestAccTencentCloudPrivateDnsRecord_basic(t *testing.T) {
10+
t.Parallel()
11+
12+
resource.Test(t, resource.TestCase{
13+
PreCheck: func() { testAccPreCheck(t) },
14+
Providers: testAccProviders,
15+
Steps: []resource.TestStep{
16+
{
17+
Config: testAccPrivateDnsRecord_basic,
18+
Check: resource.ComposeTestCheckFunc(
19+
resource.TestCheckResourceAttr("tencentcloud_private_dns_record.record", "weight", "1"),
20+
),
21+
},
22+
{
23+
ResourceName: "tencentcloud_private_dns_record.record",
24+
ImportState: true,
25+
ImportStateVerify: true,
26+
},
27+
},
28+
})
29+
}
30+
31+
const testAccPrivateDnsRecord_basic = defaultInstanceVariable + `
32+
resource "tencentcloud_private_dns_zone" "zone" {
33+
dns_forward_status = "DISABLED"
34+
domain = "domain.com"
35+
remark = "test_record"
36+
37+
tag_set {
38+
tag_key = "created_by"
39+
tag_value = "terraform"
40+
}
41+
42+
}
43+
44+
resource "tencentcloud_private_dns_record" "record" {
45+
mx = 0
46+
record_type = "A"
47+
record_value = "192.168.1.2"
48+
sub_domain = "www"
49+
ttl = 300
50+
weight = 1
51+
zone_id = tencentcloud_private_dns_zone.zone.id
52+
}
53+
54+
`
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package tencentcloud
2+
3+
import (
4+
"testing"
5+
6+
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
7+
)
8+
9+
func TestAccTencentCloudPrivateDnsZone_basic(t *testing.T) {
10+
t.Parallel()
11+
12+
resource.Test(t, resource.TestCase{
13+
PreCheck: func() { testAccPreCheck(t) },
14+
Providers: testAccProviders,
15+
Steps: []resource.TestStep{
16+
{
17+
Config: testAccPrivateDnsZone_basic,
18+
Check: resource.ComposeTestCheckFunc(
19+
resource.TestCheckResourceAttr("tencentcloud_private_dns_zone.zone", "domain", "domain.com"),
20+
),
21+
},
22+
{
23+
ResourceName: "tencentcloud_private_dns_zone.zone",
24+
ImportState: true,
25+
ImportStateVerify: true,
26+
},
27+
},
28+
})
29+
}
30+
31+
const testAccPrivateDnsZone_basic = defaultInstanceVariable + `
32+
resource "tencentcloud_private_dns_zone" "zone" {
33+
dns_forward_status = "DISABLED"
34+
domain = "domain.com"
35+
remark = "test_zone"
36+
37+
tag_set {
38+
tag_key = "created_by"
39+
tag_value = "terraform"
40+
}
41+
42+
vpc_set {
43+
region = "ap-guangzhou"
44+
uniq_vpc_id = var.cvm_vpc_id
45+
}
46+
vpc_set {
47+
region = "ap-guangzhou"
48+
uniq_vpc_id = var.vpc_id
49+
}
50+
}
51+
`

0 commit comments

Comments
 (0)