-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_gateway.tf
56 lines (44 loc) · 1.46 KB
/
api_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
resource "aws_apigatewayv2_api" "this" {
name = "tf-gh-webhook-relay"
protocol_type = "HTTP"
disable_execute_api_endpoint = local.custom_domain
}
resource "aws_apigatewayv2_stage" "default" {
api_id = aws_apigatewayv2_api.this.id
name = "$default"
auto_deploy = true
}
module "default_route" {
source = "./modules/api_gateway_route"
api_id = aws_apigatewayv2_api.this.id
route_key = "$default"
method = "ANY"
type = "HTTP_PROXY"
uri = "https://api.github.com"
payload_version = null
}
module "hooks_get_route" {
source = "./modules/api_gateway_route"
api_id = aws_apigatewayv2_api.this.id
route_key = "GET /repos/{user}/{repo}/hooks"
uri = module.get_hooks_lambda.invoke_arn
}
module "hooks_post_route" {
source = "./modules/api_gateway_route"
api_id = aws_apigatewayv2_api.this.id
route_key = "POST /repos/{user}/{repo}/hooks"
uri = module.post_hooks_lambda.invoke_arn
}
module "hooks_delete_route" {
source = "./modules/api_gateway_route"
api_id = aws_apigatewayv2_api.this.id
route_key = "DELETE /repos/{user}/{repo}/hooks/{id}"
uri = module.delete_hooks_lambda.invoke_arn
}
module "github_webhook_route" {
source = "./modules/api_gateway_route"
api_id = aws_apigatewayv2_api.this.id
route_key = "POST /webhook/{user}/{repo}"
uri = module.webhook_relay_lambda.invoke_arn
payload_version = "2.0"
}