You must be logged in to view saved presets
Sets up a basic REST API with a mock integration and deploys it, including a stage setup.
resource "aws_api_gateway_deployment" "example" {
lifecycle {
create_before_destroy = true
}
rest_api_id = aws_api_gateway_rest_api.example.id
triggers = {
redeployment = sha1(jsonencode([
aws_api_gateway_resource.example.id,
aws_api_gateway_method.example.id,
aws_api_gateway_integration.example.id,
]))
}
}
resource "aws_api_gateway_integration" "example" {
http_method = aws_api_gateway_method.example.http_method
resource_id = aws_api_gateway_resource.example.id
rest_api_id = aws_api_gateway_rest_api.example.id
type = "MOCK"
}
resource "aws_api_gateway_method" "example" {
authorization = "NONE"
http_method = "GET"
resource_id = aws_api_gateway_resource.example.id
rest_api_id = aws_api_gateway_rest_api.example.id
}
resource "aws_api_gateway_resource" "example" {
parent_id = aws_api_gateway_rest_api.example.root_resource_id
path_part = "example"
rest_api_id = aws_api_gateway_rest_api.example.id
}
resource "aws_api_gateway_rest_api" "example" {
name = "example"
}
resource "aws_api_gateway_stage" "example" {
deployment_id = aws_api_gateway_deployment.example.id
rest_api_id = aws_api_gateway_rest_api.example.id
stage_name = "example"
}