-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathapigateway.tf
45 lines (35 loc) · 1.25 KB
/
apigateway.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
resource "aws_apigatewayv2_api" "http_api" {
name = "${local.name_prefix}-topmovies-api"
protocol_type = "HTTP"
}
resource "aws_apigatewayv2_stage" "default" {
api_id = aws_apigatewayv2_api.http_api.id
name = "$default"
auto_deploy = true
}
resource "aws_apigatewayv2_integration" "apigw_lambda" {
api_id = aws_apigatewayv2_api.http_api.id
integration_uri = "" # todo: fill with apporpriate value
integration_type = "AWS_PROXY"
integration_method = "POST"
payload_format_version = "2.0"
}
# resource "aws_apigatewayv2_route" "get_topmovies" {
# # todo: fill with apporpriate value
# }
# resource "aws_apigatewayv2_route" "get_topmovies_by_year" {
# # todo: fill with apporpriate value
# }
# resource "aws_apigatewayv2_route" "put_topmovies" {
# # todo: fill with apporpriate value
# }
# resource "aws_apigatewayv2_route" "delete_topmovies_by_year" {
# # todo: fill with apporpriate value
# }
resource "aws_lambda_permission" "api_gw" {
statement_id = "AllowExecutionFromAPIGateway"
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.http_api_lambda.function_name
principal = "apigateway.amazonaws.com"
source_arn = "${aws_apigatewayv2_api.http_api.execution_arn}/*/*"
}