-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapigw-get.tf
43 lines (38 loc) · 1.7 KB
/
apigw-get.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
resource "aws_api_gateway_method" "get" {
rest_api_id = aws_api_gateway_rest_api.pastebin_api.id
resource_id = aws_api_gateway_resource.snippet_resource.id
http_method = "GET"
authorization = "NONE"
}
resource "aws_api_gateway_method_response" "get" {
depends_on = [aws_api_gateway_method.get]
rest_api_id = aws_api_gateway_rest_api.pastebin_api.id
resource_id = aws_api_gateway_resource.snippet_resource.id
http_method = aws_api_gateway_method.get.http_method
status_code = "200"
response_parameters = {
"method.response.header.Access-Control-Allow-Headers" = true,
"method.response.header.Access-Control-Allow-Methods" = true,
"method.response.header.Access-Control-Allow-Origin" = true
}
}
resource "aws_api_gateway_integration" "get" {
rest_api_id = aws_api_gateway_rest_api.pastebin_api.id
resource_id = aws_api_gateway_resource.snippet_resource.id
http_method = aws_api_gateway_method.get.http_method
integration_http_method = "POST"
type = "AWS_PROXY"
uri = aws_lambda_function.get_snippet.invoke_arn
}
resource "aws_api_gateway_integration_response" "get" {
depends_on = [aws_api_gateway_integration.get]
rest_api_id = aws_api_gateway_rest_api.pastebin_api.id
resource_id = aws_api_gateway_resource.snippet_resource.id
http_method = aws_api_gateway_method.get.http_method
status_code = "200"
response_parameters = {
"method.response.header.Access-Control-Allow-Headers" = "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",
"method.response.header.Access-Control-Allow-Methods" = "'*'",
"method.response.header.Access-Control-Allow-Origin" = "'*'"
}
}