Creates a REST API using an OpenAPI specification with a regional endpoint configuration.

Terraform Template

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_rest_api.example.body))
  }
}

resource "aws_api_gateway_rest_api" "example" {
  body = jsonencode({
 openapi = "3.0.1"
 info = {
 title = "example"
 version = "1.0"
 }
 paths = {
 "/path1" = {
 get = {
 x-amazon-apigateway-integration = {
 httpMethod = "GET"
 payloadFormatVersion = "1.0"
 type = "HTTP_PROXY"
 uri = "https://ip-ranges.amazonaws.com/ip-ranges.json"
 }
 }
 }
 }
 })

  endpoint_configuration {
    types = ["REGIONAL"]
  }
  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"
}