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