-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVCAPI.tf
78 lines (72 loc) · 2.87 KB
/
VCAPI.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
locals {
dev_server_origin = "http://localhost:3000"
VCAPI_name = "VCAPI"
VCAPI_protocol = "WEBSOCKET"
integration_type = "AWS_PROXY"
}
resource "aws_apigatewayv2_api" "VCAPI" {
name = local.VCAPI_name
protocol_type = local.VCAPI_protocol
route_selection_expression = "$request.body.action"
}
resource "aws_apigatewayv2_integration" "VC-Integration" {
api_id = aws_apigatewayv2_api.VCAPI.id
integration_type = local.integration_type
integration_uri = aws_lambda_function.VC.invoke_arn
}
resource "aws_apigatewayv2_integration" "VC-DAL-Integration" {
api_id = aws_apigatewayv2_api.VCAPI.id
integration_type = local.integration_type
integration_uri = aws_lambda_function.VC-DAL.invoke_arn
}
resource "aws_apigatewayv2_stage" "vc-stage" {
api_id = aws_apigatewayv2_api.VCAPI.id
name = "production"
auto_deploy = true
}
# ---------------------------------------- routes -------------------------------------------
resource "aws_apigatewayv2_route" "connect-route" {
api_id = aws_apigatewayv2_api.VCAPI.id
route_key = "$connect"
target = "integrations/${aws_apigatewayv2_integration.VC-Integration.id}"
}
resource "aws_apigatewayv2_route" "disconnect-route" {
api_id = aws_apigatewayv2_api.VCAPI.id
route_key = "$disconnect"
target = "integrations/${aws_apigatewayv2_integration.VC-Integration.id}"
}
resource "aws_apigatewayv2_route" "postNew-route" {
api_id = aws_apigatewayv2_api.VCAPI.id
route_key = "postNew"
target = "integrations/${aws_apigatewayv2_integration.VC-Integration.id}"
}
resource "aws_apigatewayv2_route" "postNewQuote-route" {
api_id = aws_apigatewayv2_api.VCAPI.id
route_key = "postNewQuote"
target = "integrations/${aws_apigatewayv2_integration.VC-Integration.id}"
}
resource "aws_apigatewayv2_route" "getConnectedUsers-route" {
api_id = aws_apigatewayv2_api.VCAPI.id
route_key = "getConnectedUsers"
target = "integrations/${aws_apigatewayv2_integration.VC-Integration.id}"
}
resource "aws_apigatewayv2_route" "getOwnId-route" {
api_id = aws_apigatewayv2_api.VCAPI.id
route_key = "getOwnId"
target = "integrations/${aws_apigatewayv2_integration.VC-Integration.id}"
}
resource "aws_apigatewayv2_route" "getStoredMessages-route" {
api_id = aws_apigatewayv2_api.VCAPI.id
route_key = "getStoredMessages"
target = "integrations/${aws_apigatewayv2_integration.VC-DAL-Integration.id}"
}
resource "aws_apigatewayv2_route" "verifyAuthCode-route" {
api_id = aws_apigatewayv2_api.VCAPI.id
route_key = "verifyAuthCode"
target = "integrations/${aws_apigatewayv2_integration.VC-DAL-Integration.id}"
}
resource "aws_apigatewayv2_route" "authenticateUser-route" {
api_id = aws_apigatewayv2_api.VCAPI.id
route_key = "authenticateUser"
target = "integrations/${aws_apigatewayv2_integration.VC-DAL-Integration.id}"
}