-
Notifications
You must be signed in to change notification settings - Fork 22
/
api.tf
42 lines (33 loc) · 1.05 KB
/
api.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
resource "aws_api_gateway_rest_api" "root" {
name = local.api_gateway_name
}
resource "aws_api_gateway_resource" "modules_root" {
rest_api_id = aws_api_gateway_rest_api.root.id
parent_id = aws_api_gateway_rest_api.root.root_resource_id
path_part = "modules.v1"
}
module "modules_v1" {
source = "./modules/modules.v1"
rest_api_id = aws_api_gateway_resource.modules_root.rest_api_id
parent_resource_id = aws_api_gateway_resource.modules_root.id
dynamodb_table_name = local.modules_table_name
dynamodb_query_role_arn = aws_iam_role.modules.arn
custom_authorizer_id = (
length(aws_api_gateway_authorizer.main) > 0 ? aws_api_gateway_authorizer.main[0].id : null
)
}
module "disco" {
source = "./modules/disco"
rest_api_id = aws_api_gateway_rest_api.root.id
services = {
"modules.v1" = "${aws_api_gateway_resource.modules_root.path}/",
}
}
resource "aws_api_gateway_deployment" "live" {
depends_on = [
module.modules_v1,
module.disco,
]
rest_api_id = aws_api_gateway_rest_api.root.id
stage_name = "live"
}