-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.tf
30 lines (25 loc) · 838 Bytes
/
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
resource "aws_api_gateway_rest_api" "this" {
name = "serverless-swagger-ui"
description = "This is a simple API Gateway to demonstrate the use of Swagger UI"
body = templatefile("${path.module}/api-gateway-definition.yaml",
{
region_name = data.aws_region.current.name
orders_handler_arn = aws_lambda_function.orders_handler.arn
api_docs_handler_arn = aws_lambda_function.api_docs_handler.arn
}
)
endpoint_configuration {
types = ["REGIONAL"]
}
}
resource "aws_api_gateway_deployment" "this" {
rest_api_id = aws_api_gateway_rest_api.this.id
lifecycle {
create_before_destroy = true
}
}
resource "aws_api_gateway_stage" "this" {
deployment_id = aws_api_gateway_deployment.this.id
rest_api_id = aws_api_gateway_rest_api.this.id
stage_name = "v1"
}