Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

316
Visualizações
Convert REST API described in OpenAPI specification to AWS API Gateway REST API described in Terraform template

I have OpenAPI 3.0 specification (YAML) of my REST API and I need to describe the same REST API in Terraform template (HCL) as AWS API Gateway resources.

Are there any tools which could help me to convert it automatically?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

AWS' API Gateway directly supports importing an OpenAPI 3.0 spec to define all of the relevant parts of an API Gateway.

With Terraform this can be done with the aws_api_gateway_rest_api resource and the body parameter.

An example is given in the tests for the resource:

resource "aws_api_gateway_rest_api" "test" {
  name = "foo"
  body = <<EOF
{
  "swagger": "2.0",
  "info": {
    "title": "foo",
    "version": "2017-04-20T04:08:08Z"
  },
  "schemes": [
    "https"
  ],
  "paths": {
    "/test": {
      "get": {
        "responses": {
          "200": {
            "description": "200 response"
          }
        },
        "x-amazon-apigateway-integration": {
          "type": "HTTP",
          "uri": "https://www.google.de",
          "httpMethod": "GET",
          "responses": {
            "default": {
              "statusCode": 200
            }
          }
        }
      }
    }
  }
}
EOF
}

You can also use the file function to load the OpenAPI spec from your YAML file directly:

resource "aws_api_gateway_rest_api" "test" {
  name = "foo"
  body = file("${path.module}/api.yml")
}
over 4 years ago · Santiago Trujillo Relatório

0

Perhaps try the AWS resource itself.

According to the documentation for aws_api_gateway_rest_api you can pass a body argument which is

An OpenAPI specification that defines the set of routes and integrations to create as part of the REST API.

Then, if you need to modify the OpenAPI spec some, you could use your favorite programming language that speaks JSON (e.g. node, java, even jq, etc...).

For more information and to see which extensions are available, see the API Gateway docs.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda