-
Notifications
You must be signed in to change notification settings - Fork 0
/
api-proxy-integrations.tf
53 lines (45 loc) · 2.15 KB
/
api-proxy-integrations.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
resource "aws_api_gateway_integration" "item_put_method-api_proxy_integration" {
rest_api_id = aws_api_gateway_rest_api.api_gateway.id
resource_id = aws_api_gateway_resource.item_resource.id
http_method = aws_api_gateway_method.item_put_method.http_method
type = "AWS"
integration_http_method = "PUT"
credentials = aws_iam_role.s3_proxy_role.arn
uri = "arn:aws:apigateway:${var.region}:s3:path/{bucket}/{folder}/{item}"
request_parameters = {
"integration.request.header.x-amz-meta-fileinfo" = "method.request.header.x-amz-meta-fileinfo"
"integration.request.header.Accept" = "method.request.header.Accept"
"integration.request.header.Content-Type" = "method.request.header.Content-Type"
"integration.request.path.item" = "method.request.path.item"
"integration.request.path.folder" = "method.request.path.folder"
"integration.request.path.bucket" = "method.request.path.bucket"
}
}
resource "aws_api_gateway_integration" "item_get_method-api_proxy_integration" {
rest_api_id = aws_api_gateway_rest_api.api_gateway.id
resource_id = aws_api_gateway_resource.item_resource.id
http_method = aws_api_gateway_method.item_get_method.http_method
type = "AWS"
integration_http_method = "GET"
credentials = aws_iam_role.s3_proxy_role.arn
uri = "arn:aws:apigateway:${var.region}:s3:path/{bucket}/{folder}/{item}"
request_parameters = {
"integration.request.path.item" = "method.request.path.item"
"integration.request.path.folder" = "method.request.path.folder"
"integration.request.path.bucket" = "method.request.path.bucket"
}
}
resource "aws_api_gateway_integration" "item_options_method-api_proxy_integration" {
rest_api_id = aws_api_gateway_rest_api.api_gateway.id
resource_id = aws_api_gateway_resource.item_resource.id
http_method = aws_api_gateway_method.item_options_method.http_method
type = "MOCK"
depends_on = [aws_api_gateway_method.item_options_method]
request_templates = {
"application/json" = <<EOF
{
"statusCode" : 200
}
EOF
}
}