77 tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
88)
99
10+ // go test -i; go test -test.run TestAccTencentCloudCcnRouteTableInputPoliciesDataSource_basic -v
1011func TestAccTencentCloudCcnRouteTableInputPoliciesDataSource_basic (t * testing.T ) {
1112 t .Parallel ()
1213 resource .Test (t , resource.TestCase {
@@ -20,14 +21,47 @@ func TestAccTencentCloudCcnRouteTableInputPoliciesDataSource_basic(t *testing.T)
2021 tcacctest .AccCheckTencentCloudDataSourceID ("data.tencentcloud_ccn_route_table_input_policies.example" ),
2122 resource .TestCheckResourceAttrSet ("data.tencentcloud_ccn_route_table_input_policies.example" , "ccn_id" ),
2223 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" ),
2325 ),
2426 }},
2527 })
2628}
2729
2830const 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+
2962data "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
3266}
3367`
0 commit comments