-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkong-routes.tf
120 lines (110 loc) · 3.84 KB
/
kong-routes.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
locals {
regex_uuid = "[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"
}
resource "kong_route" "route-register-user" {
protocols = [ "http", "https" ]
methods = [ "POST" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/users$" ]
# Strip the matching prefix from the upstream request URL
strip_path = false
# Use the request Host header in the upstream request headers
preserve_host = false
service_id = "${kong_service.service-user.id}"
}
resource "kong_route" "route-show-me" {
protocols = [ "http", "https" ]
methods = [ "GET" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/users/me$" ]
# Strip the matching prefix from the upstream request URL
strip_path = false
# Use the request Host header in the upstream request headers
preserve_host = false
service_id = "${kong_service.service-user.id}"
}
resource "kong_route" "route-logout-user" {
protocols = [ "http", "https" ]
methods = [ "DELETE" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/auth$" ]
# Strip the matching prefix from the upstream request URL
strip_path = false
# Use the request Host header in the upstream request headers
preserve_host = false
service_id = "${kong_service.service-user.id}"
}
resource "kong_route" "route-auth-local" {
protocols = [ "http", "https" ]
methods = [ "POST" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/auth/local$" ]
# Strip the matching prefix from the upstream request URL
strip_path = false
# Use the request Host header in the upstream request headers
preserve_host = false
service_id = "${kong_service.service-user.id}"
}
resource "kong_route" "route-create-todo" {
protocols = [ "http", "https" ]
methods = [ "POST" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/todos$" ]
# Strip the matching prefix from the upstream request URL
strip_path = false
# Use the request Host header in the upstream request headers
preserve_host = false
service_id = "${kong_service.service-todo.id}"
}
resource "kong_route" "route-list-todos" {
protocols = [ "http", "https" ]
methods = [ "GET" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/todos$" ]
# Strip the matching prefix from the upstream request URL
strip_path = false
# Use the request Host header in the upstream request headers
preserve_host = false
service_id = "${kong_service.service-todo.id}"
}
resource "kong_route" "route-show-todo" {
protocols = [ "http", "https" ]
methods = [ "GET" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/todos/(?P<txid>${local.regex_uuid})$" ]
# Strip the matching prefix from the upstream request URL
strip_path = false
# Use the request Host header in the upstream request headers
preserve_host = false
service_id = "${kong_service.service-todo.id}"
}
resource "kong_route" "route-update-todo" {
protocols = [ "http", "https" ]
methods = [ "PATCH" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/todos/(?P<txid>${local.regex_uuid})$" ]
# Strip the matching prefix from the upstream request URL
strip_path = false
# Use the request Host header in the upstream request headers
preserve_host = false
service_id = "${kong_service.service-todo.id}"
}
resource "kong_route" "route-delete-todo" {
protocols = [ "http", "https" ]
methods = [ "DELETE" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/todos/(?P<txid>${local.regex_uuid})$" ]
# Strip the matching prefix from the upstream request URL
strip_path = false
# Use the request Host header in the upstream request headers
preserve_host = false
service_id = "${kong_service.service-todo.id}"
}
# 404 Not Found
# Send traffic to a special service or apply any plugin
resource "kong_route" "route-fallback" {
protocols = [ "http", "https" ]
hosts = [ "${var.api_gateway_host}" ]
paths = [ "/" ]
service_id = "${kong_service.service-fallback.id}"
}