-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodule4-3-LambdaProxy.tf
51 lines (45 loc) · 1.82 KB
/
module4-3-LambdaProxy.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
resource "aws_api_gateway_method" "ride-method-request" {
authorizer_id = aws_api_gateway_authorizer.WildRydes.id
rest_api_id = aws_api_gateway_rest_api.wildRydes.id
resource_id = aws_api_gateway_resource.ride-resource.id
http_method = "POST"
#Learn: Use pool
authorization = "COGNITO_USER_POOLS"
request_parameters = {
"method.request.path.proxy" = true
}
}
resource "aws_api_gateway_integration" "ride-integration-request" {
type = "AWS_PROXY"
rest_api_id = aws_api_gateway_rest_api.wildRydes.id
resource_id = aws_api_gateway_resource.ride-resource.id
http_method = aws_api_gateway_method.ride-method-request.http_method
integration_http_method = aws_api_gateway_method.ride-method-request.http_method
uri = "arn:aws:apigateway:${data.aws_region.current.name}:lambda:path/2015-03-31/functions/${aws_lambda_function.request_unicorn.arn}/invocations"
request_templates = {
"application/json": "{\"statusCode\": 200}"
}
}
resource "aws_api_gateway_method_response" "ride-method-response" {
depends_on = [aws_api_gateway_integration.ride-integration-request]
http_method = aws_api_gateway_method.ride-method-request.http_method
resource_id = aws_api_gateway_resource.ride-resource.id
rest_api_id = aws_api_gateway_rest_api.wildRydes.id
status_code = "200"
response_models = {
"application/json": "Empty"
}
response_parameters = {}
}
resource "aws_api_gateway_integration_response" "ride-integration-response" {
depends_on = [aws_api_gateway_method_response.ride-method-response]
http_method = aws_api_gateway_method.ride-method-request.http_method
resource_id = aws_api_gateway_resource.ride-resource.id
rest_api_id = aws_api_gateway_rest_api.wildRydes.id
status_code = "200"
response_parameters = {}
selection_pattern = ""
response_templates = {
"application/json": ""
}
}