-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy.tf
43 lines (35 loc) · 1.4 KB
/
proxy.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
resource "aws_api_gateway_resource" "proxy" {
parent_id = aws_api_gateway_rest_api.site.root_resource_id
path_part = "{proxy+}"
rest_api_id = aws_api_gateway_rest_api.site.id
}
module "options_proxy" {
source = "github.com/jdhollis/api-gateway-options"
allow_headers = "'content-type,authorization,x-amz-date,x-api-key,x-amz-security-token,x-csrf-token'"
allow_methods = "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
allow_origin = var.allow_origin_override != "" ? var.allow_origin_override : "https://${var.domain}"
resource_id = aws_api_gateway_resource.proxy.id
rest_api_id = aws_api_gateway_rest_api.site.id
}
resource "aws_api_gateway_method" "proxy" {
authorization = "NONE"
http_method = "ANY"
request_parameters = {
"method.request.path.proxy" = true
}
resource_id = aws_api_gateway_resource.proxy.id
rest_api_id = aws_api_gateway_rest_api.site.id
}
resource "aws_api_gateway_integration" "proxy" {
connection_id = module.query_group.vpc_link_id
connection_type = "VPC_LINK"
http_method = "ANY"
integration_http_method = "ANY"
request_parameters = {
"integration.request.path.proxy" = "method.request.path.proxy"
}
resource_id = aws_api_gateway_resource.proxy.id
rest_api_id = aws_api_gateway_rest_api.site.id
type = "HTTP_PROXY"
uri = "${module.query_group.load_balancer_http_direct_endpoint}/{proxy}"
}