Skip to content

Commit 070466f

Browse files
author
ttomzhou
committed
add api gateway
1 parent fe78679 commit 070466f

File tree

78 files changed

+18271
-61
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+18271
-61
lines changed

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
1-
## 1.45.3 (Unreleased)
1+
## 1.46.0 (Unreleased)
2+
3+
FEATURES:
4+
5+
* **New Resource**: `tencentcloud_api_gateway_api`
6+
* **New Resource**: `tencentcloud_api_gateway_service`
7+
* **New Resource**: `tencentcloud_api_gateway_throttling_api`
8+
* **New Resource**: `tencentcloud_api_gateway_throttling_service`
9+
* **New Resource**: `tencentcloud_api_gateway_custom_domain`
10+
* **New Resource**: `tencentcloud_api_gateway_usage_plan`
11+
* **New Resource**: `tencentcloud_api_gateway_usage_plan_attachment`
12+
* **New Resource**: `tencentcloud_api_gateway_ip_strategy`
13+
* **New Resource**: `tencentcloud_api_gateway_strategy_attachment`
14+
* **New Resource**: `tencentcloud_api_gateway_api_key`
15+
* **New Resource**: `tencentcloud_api_gateway_api_key_attachment`
16+
* **New Resource**: `tencentcloud_api_gateway_service_release`
17+
* **New Data Source**: `tencentcloud_api_gateway_apis`
18+
* **New Data Source**: `tencentcloud_api_gateway_services`
19+
* **New Data Source**: `tencentcloud_api_gateway_throttling_apis`
20+
* **New Data Source**: `tencentcloud_api_gateway_throttling_services`
21+
* **New Data Source**: `tencentcloud_api_gateway_usage_plans`
22+
* **New Data Source**: `tencentcloud_api_gateway_ip_strategies`
23+
* **New Data Source**: `tencentcloud_api_gateway_customer_domains`
24+
* **New Data Source**: `tencentcloud_api_gateway_usage_plan_environments`
25+
* **New Data Source**: `tencentcloud_api_gateway_api_keys`
226

327
BUG FIXES:
28+
429
* Resource: `tencentcloud_clb_instance` fix force new when updating tags.
530
* Resource: `tencentcloud_redis_backup_config` fix doc issues.
631
* Resource: `tencentcloud_instance` fix `keep_image_login` force new issue when updating terraform version.
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
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+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
variable "secret_name" {
2+
default = "my_api_key"
3+
}
4+
5+
variable "status" {
6+
default = "on"
7+
}
8+
9+
variable "service_name" {
10+
default = "ck"
11+
}
12+
13+
variable "protocol" {
14+
default = "http&https"
15+
}
16+
17+
variable "service_desc" {
18+
default = "your nice service"
19+
}
20+
21+
variable "ip_version" {
22+
default = "IPv4"
23+
}
24+
25+
variable "api_name" {
26+
default = "hello"
27+
}
28+
29+
variable "api_desc" {
30+
default = "my hello api"
31+
}
32+
33+
variable "strategy_name" {
34+
default = "tf_test"
35+
}
36+
37+
variable "usage_plan_name" {
38+
default = "my_plan"
39+
}
40+
41+
variable "usage_plan_desc" {
42+
default = "nice plan"
43+
}
44+
45+
variable "release_desc" {
46+
default = "test service release"
47+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
terraform {
2+
required_version = ">= 0.12"
3+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
terraform {
2-
required_version = ">= 0.12"
1+
terraform {
2+
required_version = ">= 0.12"
33
}

0 commit comments

Comments
 (0)