7
7
tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
8
8
)
9
9
10
+ // go test -i; go test -test.run TestAccTencentCloudCcnRouteTableInputPoliciesDataSource_basic -v
10
11
func TestAccTencentCloudCcnRouteTableInputPoliciesDataSource_basic (t * testing.T ) {
11
12
t .Parallel ()
12
13
resource .Test (t , resource.TestCase {
@@ -20,14 +21,47 @@ func TestAccTencentCloudCcnRouteTableInputPoliciesDataSource_basic(t *testing.T)
20
21
tcacctest .AccCheckTencentCloudDataSourceID ("data.tencentcloud_ccn_route_table_input_policies.example" ),
21
22
resource .TestCheckResourceAttrSet ("data.tencentcloud_ccn_route_table_input_policies.example" , "ccn_id" ),
22
23
resource .TestCheckResourceAttrSet ("data.tencentcloud_ccn_route_table_input_policies.example" , "route_table_id" ),
24
+ resource .TestCheckResourceAttr ("data.tencentcloud_ccn_route_table_input_policies.example" , "policy_set.#" , "1" ),
23
25
),
24
26
}},
25
27
})
26
28
}
27
29
28
30
const testAccCcnRouteTableInputPoliciesDataSource = `
31
+ resource "tencentcloud_ccn" "example" {
32
+ name = "tf-example"
33
+ description = "description."
34
+ qos = "AG"
35
+ charge_type = "PREPAID"
36
+ bandwidth_limit_type = "INTER_REGION_LIMIT"
37
+ tags = {
38
+ createBy = "terraform"
39
+ }
40
+ }
41
+
42
+ resource "tencentcloud_ccn_route_table" "example" {
43
+ ccn_id = tencentcloud_ccn.example.id
44
+ name = "tf-example"
45
+ description = "desc."
46
+ }
47
+
48
+ resource "tencentcloud_ccn_route_table_input_policies" "example" {
49
+ ccn_id = tencentcloud_ccn.example.id
50
+ route_table_id = tencentcloud_ccn_route_table.example.id
51
+ policies {
52
+ action = "accept"
53
+ description = "desc."
54
+ route_conditions {
55
+ name = "instance-region"
56
+ values = ["ap-guangzhou"]
57
+ match_pattern = 1
58
+ }
59
+ }
60
+ }
61
+
29
62
data "tencentcloud_ccn_route_table_input_policies" "example" {
30
- ccn_id = "ccn-06jek8tf"
31
- route_table_id = "ccnrtb-4jv5ltb9"
63
+ depends_on = [ tencentcloud_ccn_route_table_input_policies.example ]
64
+ ccn_id = tencentcloud_ccn.example.id
65
+ route_table_id = tencentcloud_ccn_route_table.example.id
32
66
}
33
67
`
0 commit comments