1+ resource "tencentcloud_api_gateway_api_key" "test" {
2+ secret_name = var. secret_name
3+ status = var. status
4+ }
5+
6+ resource "tencentcloud_api_gateway_service" "service" {
7+ service_name = var. service_name
8+ protocol = var. protocol
9+ service_desc = var. service_desc
10+ net_type = [" INNER" , " OUTER" ]
11+ ip_version = var. ip_version
12+ release_limit = 100
13+ pre_limit = 100
14+ test_limit = 100
15+ }
16+
17+ resource "tencentcloud_api_gateway_api" "api" {
18+ service_id = tencentcloud_api_gateway_service. service . id
19+ api_name = var. api_name
20+ api_desc = var. api_desc
21+ auth_type = " SECRET"
22+ protocol = " HTTP"
23+ enable_cors = true
24+ request_config_path = " /user/info"
25+ request_config_method = " POST"
26+
27+ request_parameters {
28+ name = " email"
29+ position = " QUERY"
30+ type = " string"
31+ desc = " your email please?"
32+ default_value = " tom@qq.com"
33+ required = true
34+ }
35+ service_config_type = " HTTP"
36+ service_config_timeout = 10
37+ service_config_url = " http://www.tencent.com"
38+ service_config_path = " /user"
39+ service_config_method = " POST"
40+ response_type = " XML"
41+ response_success_example = " <note>success</note>"
42+ response_fail_example = " <note>fail</note>"
43+ response_error_codes {
44+ code = 10
45+ msg = " system error"
46+ desc = " system error code"
47+ converted_code = - 10
48+ need_convert = true
49+ }
50+
51+ release_limit = 100
52+ pre_limit = 100
53+ test_limit = 100
54+ }
55+
56+ resource "tencentcloud_api_gateway_custom_domain" "foo" {
57+ service_id = " service-ohxqslqe"
58+ sub_domain = " tic-test.dnsv1.com"
59+ protocol = " http"
60+ net_type = " OUTER"
61+ is_default_mapping = " false"
62+ default_domain = " service-ohxqslqe-1259649581.gz.apigw.tencentcs.com"
63+ path_mappings = [" /good#test" ," /root#release" ]
64+ }
65+
66+ resource "tencentcloud_api_gateway_ip_strategy" "test" {
67+ service_id = tencentcloud_api_gateway_service. service . id
68+ strategy_name = var. strategy_name
69+ strategy_type = " BLACK"
70+ strategy_data = " 9.9.9.9"
71+ }
72+
73+ resource "tencentcloud_api_gateway_api_key_attachment" "attach" {
74+ api_key_id = tencentcloud_api_gateway_api_key. test . id
75+ usage_plan_id = tencentcloud_api_gateway_usage_plan. plan . id
76+ }
77+
78+ resource "tencentcloud_api_gateway_usage_plan" "plan" {
79+ usage_plan_name = var. usage_plan_name
80+ usage_plan_desc = var. usage_plan_desc
81+ max_request_num = 100
82+ max_request_num_pre_sec = 10
83+ }
84+
85+ resource "tencentcloud_api_gateway_usage_plan_attachment" "attach_service" {
86+ usage_plan_id = tencentcloud_api_gateway_usage_plan. plan . id
87+ service_id = tencentcloud_api_gateway_service. service . id
88+ environment = " test"
89+ bind_type = " SERVICE"
90+ }
91+
92+ resource "tencentcloud_api_gateway_service_release" "service" {
93+ service_id = tencentcloud_api_gateway_api. api . service_id
94+ environment_name = " release"
95+ release_desc = var. release_desc
96+ }
97+
98+ resource "tencentcloud_api_gateway_strategy_attachment" "test" {
99+ service_id = tencentcloud_api_gateway_service_release. service . service_id
100+ strategy_id = tencentcloud_api_gateway_ip_strategy. test . strategy_id
101+ environment_name = " release"
102+ bind_api_id = tencentcloud_api_gateway_api. api . id
103+ }
104+
105+ data "tencentcloud_api_gateway_api_keys" "name" {
106+ secret_name = tencentcloud_api_gateway_api_key. test . secret_name
107+ }
108+
109+ data "tencentcloud_api_gateway_api_keys" "id" {
110+ api_key_id = tencentcloud_api_gateway_api_key. test . id
111+ }
112+
113+ data "tencentcloud_api_gateway_apis" "id" {
114+ service_id = tencentcloud_api_gateway_service. service . id
115+ api_id = tencentcloud_api_gateway_api. api . id
116+ }
117+
118+ data "tencentcloud_api_gateway_apis" "name" {
119+ service_id = tencentcloud_api_gateway_service. service . id
120+ api_name = tencentcloud_api_gateway_api. api . api_name
121+ }
122+
123+ data "tencentcloud_api_gateway_customer_domains" "id" {
124+ service_id = tencentcloud_api_gateway_custom_domain. foo . service_id
125+ }
126+
127+ data "tencentcloud_api_gateway_ip_strategies" "id" {
128+ service_id = tencentcloud_api_gateway_ip_strategy. test . service_id
129+ }
130+
131+ data "tencentcloud_api_gateway_ip_strategies" "name" {
132+ service_id = tencentcloud_api_gateway_ip_strategy. test . service_id
133+ strategy_name = tencentcloud_api_gateway_ip_strategy. test . strategy_name
134+ }
135+
136+ data "tencentcloud_api_gateway_services" "name" {
137+ service_name = tencentcloud_api_gateway_service. service . service_name
138+ }
139+
140+ data "tencentcloud_api_gateway_services" "id" {
141+ service_id = tencentcloud_api_gateway_service. service . id
142+ }
143+
144+ data "tencentcloud_api_gateway_throttling_apis" "id" {
145+ service_id = tencentcloud_api_gateway_service. service . id
146+ }
147+
148+ data "tencentcloud_api_gateway_throttling_apis" "foo" {
149+ service_id = tencentcloud_api_gateway_service. service . id
150+ environment_names = [" release" , " test" ]
151+ }
152+
153+ data "tencentcloud_api_gateway_throttling_services" "id" {
154+ service_id = tencentcloud_api_gateway_service. service . id
155+ }
156+
157+ data "tencentcloud_api_gateway_usage_plan_environments" "environment_test" {
158+ usage_plan_id = tencentcloud_api_gateway_usage_plan_attachment. attach_service . usage_plan_id
159+ bind_type = " SERVICE"
160+ }
161+
162+ data "tencentcloud_api_gateway_usage_plans" "name" {
163+ usage_plan_name = tencentcloud_api_gateway_usage_plan. plan . usage_plan_name
164+ }
165+
166+ data "tencentcloud_api_gateway_usage_plans" "id" {
167+ usage_plan_id = tencentcloud_api_gateway_usage_plan. plan . id
168+ }
0 commit comments