-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathapi_delete.tf
44 lines (39 loc) · 1.97 KB
/
api_delete.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
resource "aws_api_gateway_resource" "short_url_api_resource_admin_delete" {
rest_api_id = aws_api_gateway_rest_api.short_urls_api_gateway.id
parent_id = aws_api_gateway_resource.short_url_api_resource_admin.id
path_part = "{token+}"
}
resource "aws_api_gateway_method" "short_url_api_delete" {
rest_api_id = aws_api_gateway_rest_api.short_urls_api_gateway.id
resource_id = aws_api_gateway_resource.short_url_api_resource_admin_delete.id
http_method = "DELETE"
authorization = "NONE"
api_key_required = true
}
resource "aws_api_gateway_method_response" "short_url_api_delete_response" {
rest_api_id = aws_api_gateway_rest_api.short_urls_api_gateway.id
resource_id = aws_api_gateway_resource.short_url_api_resource_admin_delete.id
http_method = aws_api_gateway_method.short_url_api_delete.http_method
status_code = "200"
response_models = {
"application/json" = "Empty"
}
}
resource "aws_api_gateway_integration" "short_url_api_delete_lambda" {
rest_api_id = aws_api_gateway_rest_api.short_urls_api_gateway.id
resource_id = aws_api_gateway_resource.short_url_api_resource_admin_delete.id
http_method = aws_api_gateway_method.short_url_api_delete.http_method
integration_http_method = "POST"
type = "AWS_PROXY"
uri = "arn:aws:apigateway:${var.region}:lambda:path/2015-03-31/functions/${aws_lambda_function.short_url_delete.arn}/invocations"
}
resource "aws_api_gateway_integration_response" "short_url_api_delete_lambda_response" {
depends_on = [aws_api_gateway_integration.short_url_api_delete_lambda]
rest_api_id = aws_api_gateway_rest_api.short_urls_api_gateway.id
resource_id = aws_api_gateway_resource.short_url_api_resource_admin_delete.id
http_method = aws_api_gateway_method.short_url_api_delete.http_method
status_code = aws_api_gateway_method_response.short_url_api_delete_response.status_code
response_templates = {
"application/json" = ""
}
}