-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgateway.tf
35 lines (29 loc) · 1.04 KB
/
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
resource "aws_apigatewayv2_api" "public" {
name = "public"
protocol_type = "HTTP"
}
resource "aws_apigatewayv2_stage" "public" {
api_id = aws_apigatewayv2_api.public.id
name = "api"
auto_deploy = true
access_log_settings {
destination_arn = aws_cloudwatch_log_group.api_gw_public.arn
format = jsonencode({
requestId = "$context.requestId"
sourceIp = "$context.identity.sourceIp"
requestTime = "$context.requestTime"
protocol = "$context.protocol"
httpMethod = "$context.httpMethod"
resourcePath = "$context.resourcePath"
routeKey = "$context.routeKey"
status = "$context.status"
responseLength = "$context.responseLength"
integrationErrorMessage = "$context.integrationErrorMessage"
}
)
}
}
resource "aws_cloudwatch_log_group" "api_gw_public" {
name = "/aws/api_gw/${aws_apigatewayv2_api.public.name}"
retention_in_days = 1
}