-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger_gateway.tf
75 lines (64 loc) · 2.6 KB
/
swagger_gateway.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
resource "aws_api_gateway_resource" "auth" {
parent_id = aws_api_gateway_rest_api.meme_gateway.root_resource_id
rest_api_id = aws_api_gateway_rest_api.meme_gateway.id
path_part = "auth"
}
resource "aws_api_gateway_resource" "service" {
parent_id = aws_api_gateway_rest_api.meme_gateway.root_resource_id
rest_api_id = aws_api_gateway_rest_api.meme_gateway.id
path_part = "service"
}
resource "aws_api_gateway_resource" "auth_swagger_proxy" {
rest_api_id = aws_api_gateway_rest_api.meme_gateway.id
parent_id = aws_api_gateway_resource.auth.id
path_part = "{proxy+}"
}
resource "aws_api_gateway_resource" "service_swagger_proxy" {
rest_api_id = aws_api_gateway_rest_api.meme_gateway.id
parent_id = aws_api_gateway_resource.service.id
path_part = "{proxy+}"
}
resource "aws_api_gateway_method" "auth_proxy_method" {
rest_api_id = aws_api_gateway_rest_api.meme_gateway.id
resource_id = aws_api_gateway_resource.auth_swagger_proxy.id
http_method = "ANY"
authorization = "NONE"
request_parameters = {
"method.request.path.proxy" = true
}
}
resource "aws_api_gateway_method" "service_proxy_method" {
rest_api_id = aws_api_gateway_rest_api.meme_gateway.id
resource_id = aws_api_gateway_resource.service_swagger_proxy.id
http_method = "ANY"
authorization = "NONE"
request_parameters = {
"method.request.path.proxy" = true
}
}
resource "aws_api_gateway_integration" "auth_integration" {
rest_api_id = aws_api_gateway_rest_api.meme_gateway.id
resource_id = aws_api_gateway_resource.auth_swagger_proxy.id
http_method = aws_api_gateway_method.auth_proxy_method.http_method
type = "HTTP_PROXY"
uri = "http://${aws_eip.meme_auth_ec2.public_ip}:8080/auth/{proxy}"
integration_http_method = "ANY"
cache_key_parameters = ["method.request.path.proxy"]
timeout_milliseconds = 29000
request_parameters = {
"integration.request.path.proxy" = "method.request.path.proxy"
}
}
resource "aws_api_gateway_integration" "service_integration" {
rest_api_id = aws_api_gateway_rest_api.meme_gateway.id
resource_id = aws_api_gateway_resource.service_swagger_proxy.id
http_method = aws_api_gateway_method.service_proxy_method.http_method
type = "HTTP_PROXY"
uri = "http://${aws_eip.meme_service_ec2.public_ip}:8080/service/{proxy}"
integration_http_method = "ANY"
cache_key_parameters = ["method.request.path.proxy"]
timeout_milliseconds = 29000
request_parameters = {
"integration.request.path.proxy" = "method.request.path.proxy"
}
}